sql server Cursor question

Archived from the original Sajha.com — preserved as posted, replies can no longer be added here.
Start a New Discussion
Archived Post

I need to compare variable I get from Cursor. I need to compare the same variable from previous record of Cursor to variable from current record coming from a cursor. So, I need to save the previous value of variable to compare with current one..need something like  @Var1=@Var2, but this doesnt work.. Help please

bhikari · Jan 19, 2011 2:20 PM · 2,395 views

2 Replies

 .

bhikari · Jan 20, 2011 8:14 AM

That should be very easy. Declare @var1 varchar(255) Declare @var2 varchar(255) fetch next from cur into @var1 while @@Fetch_status=0 begin Set @var2=@var1 fetch next from cur into @var1 if (@var1=@var2) begin do something end end

virusno1 · Jan 20, 2011 2:51 PM

This conversation is preserved exactly as it was on the original Sajha.com and can't accept new replies.

Start a New Discussion

You might be interested in...

Recent Classifieds View all
Upcoming Events View all
Service Providers View all