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. [switch] 시스코 카탈리스트(Cisco Catalyst) 기본 설정

    Date2013.04.23 CategorySystem/OS Byhooni Views17496
    Read More
  2. [switch] 시스코 스위치 관리자 암호 초기화 방법

    Date2013.04.23 CategorySystem/OS Byhooni Views17186
    Read More
  3. [windows] 원격 데스크탑(터미널 서비스) 포트 변경

    Date2013.04.23 CategorySystem/OS Byhooni Views16305
    Read More
  4. [linux] X환경 GNOME에서 KDE로 바꾸는 법..

    Date2013.04.23 CategorySystem/OS Byhooni Views12365
    Read More
  5. 무선 인증 서버.. 김도.. ㅋㅋ

    Date2013.04.23 CategorySystem/OS Byhooni Views17595
    Read More
  6. 해커스랩 깨기.. 후후.. ㅋㅋ

    Date2013.04.23 CategorySystem/OS Byhooni Views18413
    Read More
  7. [linux] /etc/fstab 설정 방법.. ㅋㅋ

    Date2013.04.23 CategorySystem/OS Byhooni Views12081
    Read More
  8. [owasp] 10대 웹어플리케이션 보안 취약

    Date2013.04.23 CategorySystem/OS Byhooni Views15906
    Read More
  9. 라우팅 경로 결정 영향 요소 ㅋㅋ

    Date2013.04.23 CategorySystem/OS Byhooni Views15850
    Read More
  10. OSI (Open Systems Interconnection) 개방형 시스템간 상호 접속

    Date2013.04.23 CategorySystem/OS Byhooni Views10785
    Read More
  11. 네트워크별 MTU(최대 전송 단위)

    Date2013.04.23 CategorySystem/OS Byhooni Views17641
    Read More
  12. [router] 라우팅 프로토콜 BGP (간단한 세팅)

    Date2013.04.23 CategorySystem/OS Byhooni Views10949
    Read More
  13. [router] 시스코 라우터 명령어 모드..

    Date2013.04.23 CategorySystem/OS Byhooni Views12944
    Read More
  14. [mysql] 시간 관련 SQL구문..

    Date2013.04.23 CategorySystem/OS Byhooni Views10773
    Read More
  15. [linux] 데비안(debian.org) 리눅스 명령어 예제

    Date2006.04.23 CategorySystem/OS Byhooni Views10422
    Read More
  16. [linux] 꿀통(honeyd) 설치하기.. 메뉴얼 과정

    Date2006.04.23 CategorySystem/OS Byhooni Views20219
    Read More
Board Pagination Prev 1 ... 6 7 8 9 10 13 Next
/ 13