Views 41296 Votes 0 Comment 0
?

Shortcut

PrevPrev Article

NextNext Article

Larger Font Smaller Font Up Down Go comment Print
?

Shortcut

PrevPrev Article

NextNext Article

Larger Font Smaller Font Up Down Go comment Print
# 서브스트링 사용 예제 코드
create proc dbo.mo_exam4_2007
as
/*

    1) 시스템    : Database 테스트
    2) 기능     : mo_exam3_2007 테이블에서 birthyear, count를 출력하는 SP
    3) 입력     :  없음
    4) 작성자    : picomax
    5) 작성일자 : 2007.03.23
    6) 수정내역
    7) Test Example
         Exec mo_exam4_2007
*/
select
    convert(varchar(4),birthday) as BIRTHYEAR,
    count(birthday) as NO
from
    mo_exam3_2007 group by convert(varchar(4),birthday)

execute mo_exam4_2007


select * from mo_exam3_2007

exec mo_exam5_2007 '', '',  '', '', '857'

alter proc dbo.mo_exam5_2007
    @name    VARCHAR(30),    -- 이름
    @address    VARCHAR(50),    -- 이름
    @tel1 VARCHAR(4),    -- 전화번호1
    @tel2 VARCHAR(4),    -- 전화번호2
    @tel3 VARCHAR(4)    -- 전화번호3
AS

set nocount on

set @name = '%'+@name+'%'
set @address = '%'+@address+'%'
set @tel1 = '%'+@tel1+'%'
set @tel2 = '%'+@tel2+'%'
set @tel3 = '%'+@tel3+'%'


create table #tmp (
    name    varchar (30),
    part    varchar(50),
    birthday    varchar(10),
    hireday    varchar(10),
    address    varchar(50),
    city    varchar(30),
    country    varchar(20),
    tel1    varchar(4),
    tel2    varchar(4),
    tel3    varchar(4)
)

delete from #tmp

insert into #tmp

select 
    name,
    part,
    birthday,
    hireday,
    address,
    city,
    country,
    substring(tel,2,(charindex(')',tel)-2)) as tel1,
    substring(tel,charindex(')',tel)+2,3) as tel2,
    substring(tel,charindex('-',tel)+1,4) as tel3
from mo_exam3_2007

select 
    name,
    part,
    birthday,
    hireday,
    address,
    city,
    country,
    tel1,
    tel2,
    tel3
from #tmp
where
    name like @name
    and address like @address
    and tel1 like @tel1
    and tel2 like @tel2
    and tel3 like @tel3

?

  1. [c] 웹 메모장.. ㅋㅋ

    Date2013.04.23 CategoryDevelop Byhooni Views6823
    Read More
  2. [c++] mfc로 만든 부엌 수납 시스템(2D기반 설계)

    Date2013.04.23 CategoryDevelop Byhooni Views7262
    Read More
  3. [c++] mfc로 만든 인테리어 수납 시스템(2D기반 설계)

    Date2013.04.23 CategoryDevelop Byhooni Views7232
    Read More
  4. [c++] mfc로 만든 월플렉스 멀티 수납 시스템(2D기반 설계)

    Date2013.04.23 CategoryDevelop Byhooni Views7397
    Read More
  5. [c] 문자열 뒤집기 초간단 샘플 코드 ㅎㅎ

    Date2013.04.23 CategoryDevelop Byhooni Views7114
    Read More
  6. [js] ajax를 이용해 외부문서 불러오기..

    Date2013.04.23 CategoryDevelop Byhooni Views6794
    Read More
  7. [js] 자바스크립트 메뉴얼 사이트.. ㅋㅋ

    Date2013.04.23 CategoryDevelop Byhooni Views7408
    Read More
  8. [linux] SSH에 대한 기본 설명과 설치/설정

    Date2013.04.23 CategorySystem/OS Byhooni Views10493
    Read More
  9. [c++] mfc로 만든 사용자 계정 리스트 출력(EnumUser) 프로그램 예제

    Date2013.04.23 CategoryDevelop Byhooni Views7286
    Read More
  10. [js] 자바스크립트와 정규표현식 메뉴얼 (chm 형식)

    Date2013.04.23 CategoryDevelop Byhooni Views7611
    Read More
  11. [js] 큐 형식으로 배열사용.. ㅋㅋ

    Date2013.04.23 CategoryDevelop Byhooni Views7014
    Read More
  12. [c++] 자료구조(링크리스트,스택,큐)와 후위 표기 계산기 샘플 ㅋㅋ

    Date2013.04.23 CategoryDevelop Byhooni Views12318
    Read More
  13. [c] 서비스 거부 공격(DoS;Denial of Service) 간단 소스.. ㅋㅋ

    Date2013.04.23 CategoryDevelop Byhooni Views6713
    Read More
  14. [js] 비만 지수 측정(BMI) ㅎㅎ

    Date2013.04.23 CategoryDevelop Byhooni Views7610
    Read More
  15. 양성/음성 오류에 대한 개념

    Date2013.04.23 CategoryEtc Byhooni Views19851
    Read More
  16. 정보시스템(정보보안)의 위험관리 설명

    Date2013.04.23 CategoryEtc Byhooni Views19335
    Read More
Board Pagination Prev 1 ... 34 35 36 37 38 ... 74 Next
/ 74