Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Cursors
Message
 
 
To
17/06/2011 10:52:31
General information
Forum:
Microsoft SQL Server
Category:
Other
Title:
Environment versions
SQL Server:
SQL Server 2005
Miscellaneous
Thread ID:
01514874
Message ID:
01514894
Views:
44
>>>>SQL Server is all about set-based operations. If you can perform your process with set-based, it will be better than using cursors.
>>>>If there is absolutely no set-based alternative, then I suggest to read Brad Schulz series about cursors
>>>>
>>>>The Truth about Cursors - Part 1
>>>>
>>>>and other parts.
>>>
>>>I'm not sure what you mean by set based operations
>>>
>>>Thanks
>>
>>If in your previous post you were talking about temporary storage of the query result (this is what VFP cursors are), then in SQL Server you can use
>>1. CTE (common table expression) or derived table - the result of CTE must be used in a next statement (e.g. it can hold data only 'once')
>>2. Temp table (table that starts with # sign and stored in TempDB)
>>3. Table variable (can be used if you're not producing a large set).
>
>How long does a temporary table (option 2) persist ?
>
>Thanks

Until the connection closes that created it or until you explicitly drop it with DROP command. (Or, of course, if SQL Server is re-started and TempDB re-created).
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform