how to use cursor
hi friends i need to know about cursors in sqlserver....i have a table called "kkk" with a column "status"...two values "present" and "absent" represents the column "status"...i want to count how many values represent "present" and "status"..i want this task to be done using cursors...i am very new to sqlserver....any other method is also appreciated....help me friends....
Mauricio RosaPosted Feb 25, 2010, 1:03 PM
I think that you´re only tring to understand how to cursos work in SQL Server, rigth?
How you´re new in SQL Server, it´s important keep in mind that cursors must be used only if have not another way to do what you need to do.
Look using good eyes to temporary tables once SQL Server is optmized to work with them. Used on SQL Server, cursors deprecate the server perfomance in higher levels
Regards
Kirtan PatelPosted Feb 8, 2010, 9:42 PM
Bryian TanPosted Feb 8, 2010, 2:32 PM
Can you post the tSql you have now and I can look into it.
Thanks,
Bryian Tan
kiran kumarPosted Feb 8, 2010, 11:48 AM
Bryian TanPosted Feb 8, 2010, 11:41 AM
try this example http://blog.ysatech.com/post/2009/08/02/SQL-2005-Cursor-Template.aspx
Thanks,
Bryian Tan