sql - Test on @@FETCH_STATUS deletes other variables -
im using scroll cursor on table username , other information on each row. need detect change of user know information point can sent 1 user, point another...
it works fine when have 1 user in table:
user1|something1|something1 user1|something2|something2 user1|something3|something3
i need detect end, did this:
declare @cr cursor scroll select etc... fetch first cr ... while @@fetch_status=0 begin ... collect data /*here problem*/ fetch next ... /* collected data cursor here still exists (lets call them @data)*/ if @@fetch_status=-1 begin -- here @data = null end end
i dont understand why is. in words, need know last line before gone. thank you
while loop fine. concatenating varchar null blame. varchar big mssms show in result or messages windows.
Comments
Post a Comment