July 8, 2013 at 7:22 am
I am using TableVariable inside Cursor ,So it is not returing the results for all values provided .Its returing only for 1st value to it and then it keep on executing .
-How to delete all data from Table Variable.
July 8, 2013 at 7:30 am
DELETE FROM @TableVariableName
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
July 8, 2013 at 7:33 am
Thanks But Its not working , I want to delete all records from TableVariable
July 8, 2013 at 7:38 am
What Gail posted will delete all rows from your table variable.
If you want to make your process a lot faster maybe you should consider getting rid of the cursor? Cursors are notoriously slow and should be avoided for most things in sql server. I would be happy to help if you want.
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
July 8, 2013 at 7:46 am
Hi,
Thanks yes its working fine , I was doing some mistake last time..
July 8, 2013 at 8:19 am
Rakesh.Chaudhary (7/8/2013)
Hi,Thanks yes its working fine , I was doing some mistake last time..
So now do you want to get rid of the cursor?
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply