-- 문자열 구분자 분할 및 분할된 배열 갯수만큼 반복



declare @tstr varchar(100)
, @i int
, @tsql varchar(5000)
, @k int

create table #tbTemp
(aa varchar(50))

set @k = 1
while exists (select aa from tempTb where idx = @k)
Begin
select @tstr=aa from tempTb where idx = @k
select @i = charindex('||', @tstr)
if @i > 0
begin
while @i > 0
begin
insert into #tbTemp values(left(@tstr, charIndex('||', @tstr)-1))
select @tstr = substring(@tstr, charindex('||', @tstr) + 2, len(@tstr))
select @i = charindex('||' , @tstr)
end
select @tsql = left(@tsql, len(@tsql)-2)
insert into #tbTemp values (@tstr)
end
else
insert into #tbTemp values(@tstr)

set @k = @k + 1
End

select aa, count(aa) as cnt from #tbTemp
group by aa
order by aa

drop table #tbTemp
크리에이티브 커먼즈 라이센스
Creative Commons License
이올린에 북마크하기

Posted by 홍반장

2008/01/28 17:41 2008/01/28 17:41
Response
No Trackback , No Comment
RSS :
http://tcbs17.cafe24.com/tc/rss/response/2954

Trackback URL : http://tcbs17.cafe24.com/tc/trackback/2954

« Previous : 1 : ... 3467 : 3468 : 3469 : 3470 : 3471 : 3472 : 3473 : 3474 : 3475 : ... 6391 : Next »

블로그 이미지

- 홍반장

Archives

Recent Trackbacks

Calendar

«   2024/11   »
          1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
Statistics Graph

Site Stats

Total hits:
240449
Today:
245
Yesterday:
856