April 23, 2008 at 2:39 am
Hi
I'm new to the Database section but been to the Web development in .net using C# in the front end and middle. I would like to know more about the cursors like the scenario where we can use this Cursors , merits and demerits of using this. Can anyone provide any links or information.
Thanks in advance
Regards
Nicsam
April 23, 2008 at 3:20 am
In general, don't.
Cursors are, in SQLServer (and relational database in general) terms, a hack - and a bad one. What you should be aiming to do (and this is a bit of a mindset switch) is avoiding procedural methods and instead looking to implement Set Based methods instead. This will also mean avoiding things such as Temp tables and table variables the vast majority of the time.
Rather than rehash (probably badly) a deep body of knowledge - do a google on Celko, a guy who explains set based problem solving very well (consider buying one of his books - and no, I'm not his agent) or doing a search on cursors in this forum where you'll find some excellent info on the issue from the regulars.
If your problem IS actually a procedural one (but give this due consideration) - go back to C#, as that is a more appropriate tool, and use a view or SP to generate the dataset you're processing.
April 23, 2008 at 4:42 am
[font="Verdana"]
These are few good sites where you can search and update your SQL skills.
http://www.sqlservercentral.com/
Mahesh
[/font]
MH-09-AM-8694
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply