March 23, 2017 at 11:31 am
I want to create a cursor where it has a select query.(select emp1,emp2 from employee)
I want to get those columns Information from this cursor.
March 23, 2017 at 12:01 pm
1) WHY?!?!?! They're horribly inefficient.
2) How to create a CURSOR You haven't given enough information, but this link will give you the basics.
3) WHY?!?!?! They're horribly inefficient.
Drew
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
March 23, 2017 at 1:38 pm
This seems to be part of the problem from the following thread: https://www.sqlservercentral.com/Forums/1866309/Question-on-Outer-and-Inner-Cursor
March 24, 2017 at 9:30 am
Hi mcfarlandparkway ,
I hope you can use the code below as example of cursor:::
Declare @emp1 varchar(20)
Declare @emp2 varchar(20)
Declare Mycursor cursor for
Select * from employee
open Mycursor
fetch next from Mycursor into @emp1,@emp2
while (@@FETCH_STATUS=0)
begin
Print @emp1 +' '+ @emp2
fetch next from Mycursor into @emp1,@emp2
end
Close Mycursor
Deallocate Mycursor
Regards
Anna
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply