I have create an employeeData table.
From this table i want to print Emp_Salray one by one by the use of cursor.
Declare @sal int
declare Cursor_Sal_Sum cursor read_only
for
select Emp_Salary from employeeData
open Cursor_Sal_Sum
fetch next from Cursor_Sal_Sum into @sal
while @@FETCH_STATUS=0
begin
print @sal
fetch next from Cursor_Sal_Sum into @sal
end
close Cursor_Sal_Sum
deallocate Cursor_Sal_Sum
Output :
23000
10000
No comments:
Post a Comment