SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
Register Now and get your question answered!
Save Password
Forgot your Password?

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Table Variable
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Posting Yak Master

103 Posts

Posted - 03/18/2009 :  03:58:15  Show Profile  Reply with Quote
I am using a Table Variable in My stored Procedure. The stored procedure is too long. I need this Table variable in early part of the stored procedure only. How can I clean up the Table variable after I finished using it? I dont want it to exist untill stored procedure finishes.

Rahul Shinde

Posting Yak Master

115 Posts

Posted - 03/18/2009 :  04:21:12  Show Profile  Visit heavymind's Homepage  Send heavymind an ICQ Message  Reply with Quote
for this purpose you better use temporary table...

Thanks, Vadym
MCITP DBA 2005/2008
Chief DBA at http://www.db-staff.com
Go to Top of Page

Patron Saint of Lost Yaks

30397 Posts

Posted - 03/18/2009 :  04:26:38  Show Profile  Visit SwePeso's Homepage  Reply with Quote
You can't. The table variable is there for the scope of entire stored procedure.
You can however do a DELETE FROM @MyTableVariableNameHere if you want to empty the table.

E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000