create procedure SIN_KUNNR_SEARCH
@startchar varchar(2)
as
begin
declare @hangle_jaeum varchar(100)
declare @english varchar(100)
declare @count varchar(100)
declare @endchar varchar(2)
set @hangle_jaeum = 'ㄱㄴㄷㄹㅁㅂㅅㅇㅈㅊㅋㅌㅍㅎ힣'
set @english ='ABCDEFGHIJKLMNOPQRSTUVWXYZ('
set @count = '1234567890'
set @endchar = SUBSTRING(@hangle_jaeum, charindex( @startchar, @hangle_jaeum, 0 )+1, 1 )
if charindex( @startchar, @english, 0 )>0
begin select NAME1 from SIN_KUNNR where substring(NAME1,1,1)between 'a' and 'z' order by NAME1
end
else if charindex( @startchar, @count, 0)>0
begin select NAME1 from SIN_KUNNR where substring(NAME1,1,1) between '0' and '9' order by NAME1
end
else if charindex( @startchar, @hangle_jaeum, 0 )>0
begin select NAME1 from SIN_KUNNR where NAME1 between @startchar and @endchar
end
end
No comments:
Post a Comment