Visual studio feeds

All Visual Studio blogs in one place

Subscribe

Enter your email address:

Delivered by FeedBurner

Increase your website traffic with Attracta.com

Google+

Contact

Email:
Subject:
Message:
Anti-spam: How many eyes has a typical person?

Follow us on FB

Search

Storage of table variable

AddThis Social Bookmark Button
Did you know that table variables are stored in the tempdb database for execution scope only?. Ok. Let us run this code declare @t table(i int) select * from tempdb.INFORMATION_SCHEMA.TABLES The result is TABLE_CATALOG TABLE_SCHEMA TABLE_NAME TABLE_TYPE --------------------------------------------------------------------- tempdb dbo #BAB3F665 BASE TABLE If your server does not use any temporary tables, you will get the above
result only. As you see a table variable is stored in the tempdb database for the execution scope only just like a temporary table. The name is prefixed by #. But unlike a temporary table, the name does not contain underscores. Becauase they are stored in execution scope only, you cannot query the INFORMATION_SCHEMA.TABLES alone to get the table variable information. The following code will not show you any table vaiables select * from tempdb.INFORMATION_SCHEMA.TABLES How many of you know this?
...(Read whole news on source site)

Home : Blog List : Madhivanan's TSQL Blog : Storage of table variable