November 3, 2006 at 8:25 am
Pretty sure i do not want to run this against mucho rows but...
declare @values varchar(1000), @sIdx1 int
set @sIdx1 = 0
declare @myVal table (id int identity, rptr varchar(10))
set @values = ltrim(rtrim('7104 7106 7112 7107 7132 7108 7150 7105 7110 7109 7111 7104 7106 7112 7107 7132 7108 7150 7105 7110 7109 7111 2 '))
while len(@values) > 0
BEGIN
select @sIdx1 = charindex(' ', @values)
if @sIdx1 = 0
set @sIdx1 = len(@values)
insert into @myVal (rptr) values(left(@values, @sIdx1 - 1))
set @values = right(@values, len(@values) - @sIdx1)
END
--=== query table variable for multiples
select rptr, count(*) from @myVal group by rptr
November 6, 2006 at 9:20 am
Parse the string into a temp table and do a:
Select count(*) from dbo.#tmp group by ValueColumn having count(*)>1
Viewing 2 posts - 16 through 16 (of 16 total)
You must be logged in to reply to this topic. Login to reply