|
Posted by SQLNewbie on 09/20/06 19:00
I have the following cursor that I am comparing 2 tables, the
production table and a copy of the production table, I want results of
all address's that are like the address1 field...the problem is...my
results are giving me every field and if there is more than one, it is
putting it in a grid....
I only want to see results if they are > 1 for the same address field
this is what I have so far....
declare @address1 char(61),@city char(61)
declare address_cursor CURSOR FOR
SELECT address1,city FROM test.dbo.testadd
OPEN address_cursor
fetch next from address_cursor into @address1,@city
while @@fetch_status = 0
BEGIN
select * from testadd where @address1 like '%' + address1 + '%' and
@city = city
Fetch next from address_cursor into @address1,@city
Print
END
CLOSE address_cursor
DEallocate address_cursor
Navigation:
[Reply to this message]
|