<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: SQL SERVER &#8211; Difference TempTable and Table Variable &#8211; TempTable in Memory a Myth</title>
	<atom:link href="http://blog.sqlauthority.com/2009/12/15/sql-server-difference-temptable-and-table-variable-temptable-in-memory-a-myth/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.sqlauthority.com/2009/12/15/sql-server-difference-temptable-and-table-variable-temptable-in-memory-a-myth/</link>
	<description>Personal Notes of Pinal Dave</description>
	<lastBuildDate>Sun, 26 May 2013 03:27:17 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: Dastagiri</title>
		<link>http://blog.sqlauthority.com/2009/12/15/sql-server-difference-temptable-and-table-variable-temptable-in-memory-a-myth/#comment-465147</link>
		<dc:creator><![CDATA[Dastagiri]]></dc:creator>
		<pubDate>Sat, 27 Apr 2013 19:53:29 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=7544#comment-465147</guid>
		<description><![CDATA[hi,
I have created procedure like .

USE [master]
GO
/****** Object:  StoredProcedure [dbo].[b]    Script Date: 04/28/2013 01:09:39 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER proc [dbo].[b]
as 
begin
declare @i table (id int)
select * From tempdb.sys.tables
end

and after i ran the executed my proce

exec b

The result is :
name                objectid
#023D5A04        37575172 and so on...

i closed the above connection and after i opened new connection and ran the query like

select * from tempdb.sys.tables

it is showing the below result and table exists in tempdb with the name:

The result is :
name                objectid
#023D5A04        37575172 and so on...

Question is:
Why did not it automatically dropped when i ran procedure and even i closed the connection please help on this..

Thanks,
Dastagiri]]></description>
		<content:encoded><![CDATA[<p>hi,<br />
I have created procedure like .</p>
<p>USE [master]<br />
GO<br />
/****** Object:  StoredProcedure [dbo].[b]    Script Date: 04/28/2013 01:09:39 ******/<br />
SET ANSI_NULLS ON<br />
GO<br />
SET QUOTED_IDENTIFIER ON<br />
GO<br />
ALTER proc [dbo].[b]<br />
as<br />
begin<br />
declare @i table (id int)<br />
select * From tempdb.sys.tables<br />
end</p>
<p>and after i ran the executed my proce</p>
<p>exec b</p>
<p>The result is :<br />
name                objectid<br />
#023D5A04        37575172 and so on&#8230;</p>
<p>i closed the above connection and after i opened new connection and ran the query like</p>
<p>select * from tempdb.sys.tables</p>
<p>it is showing the below result and table exists in tempdb with the name:</p>
<p>The result is :<br />
name                objectid<br />
#023D5A04        37575172 and so on&#8230;</p>
<p>Question is:<br />
Why did not it automatically dropped when i ran procedure and even i closed the connection please help on this..</p>
<p>Thanks,<br />
Dastagiri</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ranadeep Ghosh</title>
		<link>http://blog.sqlauthority.com/2009/12/15/sql-server-difference-temptable-and-table-variable-temptable-in-memory-a-myth/#comment-433327</link>
		<dc:creator><![CDATA[Ranadeep Ghosh]]></dc:creator>
		<pubDate>Thu, 07 Mar 2013 10:15:07 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=7544#comment-433327</guid>
		<description><![CDATA[I have written the following code in my stored Procedure which cause error while compiling. Please help.

if @l_Class_Code  &#039;55&#039;
	 begin
		 SELECT  row_number() over(order by t.Class_Code) as srl,t.*
							 into #TmpPolicyDetails
							 FROM uplPolicyDetails  t
							 Where  convert(nvarchar(10),DateReceiptatTpa,103) = @DateReceivedAtTpa
							 and   Office_Code = @BranchCode
							 and   LocationID  = @LocationID
							 and   UploadedByID = cast(@UserCode as nvarchar(20))
							 and   Class_Code = @l_Class_Code
							 and   Updated = &#039;N&#039;;	
						  end;
 else
	 begin
		SELECT  row_number() over(order by t.Class_Code) as srl,t.*
							 into #TmpPolicyDetails
							 FROM uplPolicyDetails  t
							 Where convert(nvarchar(10),DateReceiptatTpa,103) = @DateReceivedAtTpa
							 and   Office_Code = @BranchCode
							 and   LocationID  = @LocationID
							 and   UploadedByID = cast(@UserCode as nvarchar(20))
							 and   Class_Code = @l_Class_Code
							 and   cast(rtrim(ltrim(DevOfficerID)) as int) = @l_DevOfficerID
							 and   Updated = &#039;N&#039;;	
 end;]]></description>
		<content:encoded><![CDATA[<p>I have written the following code in my stored Procedure which cause error while compiling. Please help.</p>
<p>if @l_Class_Code  &#8217;55&#8242;<br />
	 begin<br />
		 SELECT  row_number() over(order by t.Class_Code) as srl,t.*<br />
							 into #TmpPolicyDetails<br />
							 FROM uplPolicyDetails  t<br />
							 Where  convert(nvarchar(10),DateReceiptatTpa,103) = @DateReceivedAtTpa<br />
							 and   Office_Code = @BranchCode<br />
							 and   LocationID  = @LocationID<br />
							 and   UploadedByID = cast(@UserCode as nvarchar(20))<br />
							 and   Class_Code = @l_Class_Code<br />
							 and   Updated = &#8216;N&#8217;;<br />
						  end;<br />
 else<br />
	 begin<br />
		SELECT  row_number() over(order by t.Class_Code) as srl,t.*<br />
							 into #TmpPolicyDetails<br />
							 FROM uplPolicyDetails  t<br />
							 Where convert(nvarchar(10),DateReceiptatTpa,103) = @DateReceivedAtTpa<br />
							 and   Office_Code = @BranchCode<br />
							 and   LocationID  = @LocationID<br />
							 and   UploadedByID = cast(@UserCode as nvarchar(20))<br />
							 and   Class_Code = @l_Class_Code<br />
							 and   cast(rtrim(ltrim(DevOfficerID)) as int) = @l_DevOfficerID<br />
							 and   Updated = &#8216;N&#8217;;<br />
 end;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SQL SERVER &#8211; SSMS does NOT Print NULL Values &#124; SQL Server Journey with SQL Authority</title>
		<link>http://blog.sqlauthority.com/2009/12/15/sql-server-difference-temptable-and-table-variable-temptable-in-memory-a-myth/#comment-431167</link>
		<dc:creator><![CDATA[SQL SERVER &#8211; SSMS does NOT Print NULL Values &#124; SQL Server Journey with SQL Authority]]></dc:creator>
		<pubDate>Mon, 04 Mar 2013 01:30:26 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=7544#comment-431167</guid>
		<description><![CDATA[[...] is a very interesting question asked on the blog by Karthik. I really liked the question and I would like to discuss this [...]]]></description>
		<content:encoded><![CDATA[<p>[...] is a very interesting question asked on the blog by Karthik. I really liked the question and I would like to discuss this [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: karthik</title>
		<link>http://blog.sqlauthority.com/2009/12/15/sql-server-difference-temptable-and-table-variable-temptable-in-memory-a-myth/#comment-430204</link>
		<dc:creator><![CDATA[karthik]]></dc:creator>
		<pubDate>Sat, 02 Mar 2013 06:30:36 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=7544#comment-430204</guid>
		<description><![CDATA[declare @var1 numeric(10,2),
@var2 numeric(10,2),
@var3 numeric(10,2),
@var4 numeric(10,2)

set @var1=12500
set @var2=NULL
set @var3=500

select @var4=(@var1+@var2+@var3)

print @var4



Why its not print the value sir...]]></description>
		<content:encoded><![CDATA[<p>declare @var1 numeric(10,2),<br />
@var2 numeric(10,2),<br />
@var3 numeric(10,2),<br />
@var4 numeric(10,2)</p>
<p>set @var1=12500<br />
set @var2=NULL<br />
set @var3=500</p>
<p>select @var4=(@var1+@var2+@var3)</p>
<p>print @var4</p>
<p>Why its not print the value sir&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Saravanan Manivasagam</title>
		<link>http://blog.sqlauthority.com/2009/12/15/sql-server-difference-temptable-and-table-variable-temptable-in-memory-a-myth/#comment-429327</link>
		<dc:creator><![CDATA[Saravanan Manivasagam]]></dc:creator>
		<pubDate>Thu, 28 Feb 2013 19:18:14 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=7544#comment-429327</guid>
		<description><![CDATA[Hi Pinal,


Thanks for the article. I noticed the below with your example. When I execute the below query

SELECT *
FROM sys.dm_db_session_space_usage
where session_id = 

I see after creating temp table the user_objects_dealloc_page_count value is 0. But After creating table variable the value is equal to the pages created. It seems, the pages are deallocated and the data is kept in memory incase of table variable. I also read an article which says, table variable will flush the data to tempdb when it come across memory pressure.]]></description>
		<content:encoded><![CDATA[<p>Hi Pinal,</p>
<p>Thanks for the article. I noticed the below with your example. When I execute the below query</p>
<p>SELECT *<br />
FROM sys.dm_db_session_space_usage<br />
where session_id = </p>
<p>I see after creating temp table the user_objects_dealloc_page_count value is 0. But After creating table variable the value is equal to the pages created. It seems, the pages are deallocated and the data is kept in memory incase of table variable. I also read an article which says, table variable will flush the data to tempdb when it come across memory pressure.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rajesh Sharma</title>
		<link>http://blog.sqlauthority.com/2009/12/15/sql-server-difference-temptable-and-table-variable-temptable-in-memory-a-myth/#comment-419818</link>
		<dc:creator><![CDATA[Rajesh Sharma]]></dc:creator>
		<pubDate>Sat, 09 Feb 2013 11:36:35 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=7544#comment-419818</guid>
		<description><![CDATA[Great tutorial]]></description>
		<content:encoded><![CDATA[<p>Great tutorial</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: madhivanan</title>
		<link>http://blog.sqlauthority.com/2009/12/15/sql-server-difference-temptable-and-table-variable-temptable-in-memory-a-myth/#comment-405255</link>
		<dc:creator><![CDATA[madhivanan]]></dc:creator>
		<pubDate>Tue, 08 Jan 2013 13:45:45 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=7544#comment-405255</guid>
		<description><![CDATA[Post the exact code you used so that it is easy to answer]]></description>
		<content:encoded><![CDATA[<p>Post the exact code you used so that it is easy to answer</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: web developer</title>
		<link>http://blog.sqlauthority.com/2009/12/15/sql-server-difference-temptable-and-table-variable-temptable-in-memory-a-myth/#comment-403628</link>
		<dc:creator><![CDATA[web developer]]></dc:creator>
		<pubDate>Fri, 04 Jan 2013 14:31:40 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=7544#comment-403628</guid>
		<description><![CDATA[I use #temp table in select statements in nested if I am getting error that table already declared in second if statement. Why is that.]]></description>
		<content:encoded><![CDATA[<p>I use #temp table in select statements in nested if I am getting error that table already declared in second if statement. Why is that.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Imran Mohammed</title>
		<link>http://blog.sqlauthority.com/2009/12/15/sql-server-difference-temptable-and-table-variable-temptable-in-memory-a-myth/#comment-369337</link>
		<dc:creator><![CDATA[Imran Mohammed]]></dc:creator>
		<pubDate>Mon, 05 Nov 2012 01:30:39 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=7544#comment-369337</guid>
		<description><![CDATA[@Pinal.

The only reason I can think of when I use temporary variables against temporary tables is when I have to perform ROLLBACK operation. 

Like some one mentioned above in their comments. Rollback operation also rollesback data from temporary tables. I usually do logging in temporary variables and even if the transactiosn rollsback, I still want to see why the transaction failed and until what point it executed with no errors. I capture all this information in table variables, on error I rollback the transaction but I still have all my information logged in table variables which is not rolledback which I then write to my permemnant tables as part of error handling. 

There is a difference in scope of Table Variable and Temporary table.  I usually prefer Temporary tables over table variables when working with Dynamix SQL, they are easy to work with.

~ IM.]]></description>
		<content:encoded><![CDATA[<p>@Pinal.</p>
<p>The only reason I can think of when I use temporary variables against temporary tables is when I have to perform ROLLBACK operation. </p>
<p>Like some one mentioned above in their comments. Rollback operation also rollesback data from temporary tables. I usually do logging in temporary variables and even if the transactiosn rollsback, I still want to see why the transaction failed and until what point it executed with no errors. I capture all this information in table variables, on error I rollback the transaction but I still have all my information logged in table variables which is not rolledback which I then write to my permemnant tables as part of error handling. </p>
<p>There is a difference in scope of Table Variable and Temporary table.  I usually prefer Temporary tables over table variables when working with Dynamix SQL, they are easy to work with.</p>
<p>~ IM.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Imran Mohammed</title>
		<link>http://blog.sqlauthority.com/2009/12/15/sql-server-difference-temptable-and-table-variable-temptable-in-memory-a-myth/#comment-369334</link>
		<dc:creator><![CDATA[Imran Mohammed]]></dc:creator>
		<pubDate>Mon, 05 Nov 2012 01:22:35 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=7544#comment-369334</guid>
		<description><![CDATA[@said, 

Table Variable has to be defined and declared, unlike a temporary table. 

You cannot get a structure into a Table variable unlike temporary table.

Simple example to declare a table variable. 

Declare @Example Table (Eid int NOT NULL, EmpName varchar(40) NOT NULL)

There is always an option to go dynamic and build a table variable by reading the source table structure, but I dont recommend it unless it is absolutely neccessary. If the table structure does not change, then declare the table variable as shown above.

Hope this helps.

~ IM.]]></description>
		<content:encoded><![CDATA[<p>@said, </p>
<p>Table Variable has to be defined and declared, unlike a temporary table. </p>
<p>You cannot get a structure into a Table variable unlike temporary table.</p>
<p>Simple example to declare a table variable. </p>
<p>Declare @Example Table (Eid int NOT NULL, EmpName varchar(40) NOT NULL)</p>
<p>There is always an option to go dynamic and build a table variable by reading the source table structure, but I dont recommend it unless it is absolutely neccessary. If the table structure does not change, then declare the table variable as shown above.</p>
<p>Hope this helps.</p>
<p>~ IM.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: vishnuvardhan</title>
		<link>http://blog.sqlauthority.com/2009/12/15/sql-server-difference-temptable-and-table-variable-temptable-in-memory-a-myth/#comment-368553</link>
		<dc:creator><![CDATA[vishnuvardhan]]></dc:creator>
		<pubDate>Sat, 03 Nov 2012 11:45:36 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=7544#comment-368553</guid>
		<description><![CDATA[temporary table gives better performance than temporary variable.why means when we want to fire any query the temp table with bulk data gives result with max speed . table variable only for small amount of data.]]></description>
		<content:encoded><![CDATA[<p>temporary table gives better performance than temporary variable.why means when we want to fire any query the temp table with bulk data gives result with max speed . table variable only for small amount of data.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nikash</title>
		<link>http://blog.sqlauthority.com/2009/12/15/sql-server-difference-temptable-and-table-variable-temptable-in-memory-a-myth/#comment-352904</link>
		<dc:creator><![CDATA[Nikash]]></dc:creator>
		<pubDate>Tue, 25 Sep 2012 07:07:35 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=7544#comment-352904</guid>
		<description><![CDATA[Hi Pinal, 
              Let I am creating a Payroll module which is supposed to generate pay slip for 50 Thousands employees at a time and In my Proc I  am dealing with temp table ,which is not good by some experts view ,so please help me how should I deal ?

              I think ,  I should adopt table partitioning concept on main transaction table and based on that i will go forward in my GUI.Is it Fine or what step should I adopt.                 

 
Please Clarify ASAP . Thanks.]]></description>
		<content:encoded><![CDATA[<p>Hi Pinal,<br />
              Let I am creating a Payroll module which is supposed to generate pay slip for 50 Thousands employees at a time and In my Proc I  am dealing with temp table ,which is not good by some experts view ,so please help me how should I deal ?</p>
<p>              I think ,  I should adopt table partitioning concept on main transaction table and based on that i will go forward in my GUI.Is it Fine or what step should I adopt.                 </p>
<p>Please Clarify ASAP . Thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nikash</title>
		<link>http://blog.sqlauthority.com/2009/12/15/sql-server-difference-temptable-and-table-variable-temptable-in-memory-a-myth/#comment-352902</link>
		<dc:creator><![CDATA[Nikash]]></dc:creator>
		<pubDate>Tue, 25 Sep 2012 06:57:38 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=7544#comment-352902</guid>
		<description><![CDATA[Hi Pinal,
         
             On which basis we will distinguish Large Table and Small Table.
            
             Can I say transaction table as Large table and master table is small table.Please Clarify . Thanks.]]></description>
		<content:encoded><![CDATA[<p>Hi Pinal,</p>
<p>             On which basis we will distinguish Large Table and Small Table.</p>
<p>             Can I say transaction table as Large table and master table is small table.Please Clarify . Thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nikash</title>
		<link>http://blog.sqlauthority.com/2009/12/15/sql-server-difference-temptable-and-table-variable-temptable-in-memory-a-myth/#comment-352891</link>
		<dc:creator><![CDATA[Nikash]]></dc:creator>
		<pubDate>Tue, 25 Sep 2012 06:33:28 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=7544#comment-352891</guid>
		<description><![CDATA[Hi Pinal,

Can you Please tell me , in a distributed environment if I use temp table , am I going to face any performance issue.]]></description>
		<content:encoded><![CDATA[<p>Hi Pinal,</p>
<p>Can you Please tell me , in a distributed environment if I use temp table , am I going to face any performance issue.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: madhivanan</title>
		<link>http://blog.sqlauthority.com/2009/12/15/sql-server-difference-temptable-and-table-variable-temptable-in-memory-a-myth/#comment-336229</link>
		<dc:creator><![CDATA[madhivanan]]></dc:creator>
		<pubDate>Thu, 23 Aug 2012 10:48:38 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=7544#comment-336229</guid>
		<description><![CDATA[Yes you can add indcies to the temp tables]]></description>
		<content:encoded><![CDATA[<p>Yes you can add indcies to the temp tables</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gowri Shanakr</title>
		<link>http://blog.sqlauthority.com/2009/12/15/sql-server-difference-temptable-and-table-variable-temptable-in-memory-a-myth/#comment-331987</link>
		<dc:creator><![CDATA[Gowri Shanakr]]></dc:creator>
		<pubDate>Fri, 17 Aug 2012 07:41:06 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=7544#comment-331987</guid>
		<description><![CDATA[yes]]></description>
		<content:encoded><![CDATA[<p>yes</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: student</title>
		<link>http://blog.sqlauthority.com/2009/12/15/sql-server-difference-temptable-and-table-variable-temptable-in-memory-a-myth/#comment-330986</link>
		<dc:creator><![CDATA[student]]></dc:creator>
		<pubDate>Wed, 15 Aug 2012 18:01:42 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=7544#comment-330986</guid>
		<description><![CDATA[Can we add index on temp table &#039;#testtable&#039;?


Thanks]]></description>
		<content:encoded><![CDATA[<p>Can we add index on temp table &#8216;#testtable&#8217;?</p>
<p>Thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rakesh Bhavsar</title>
		<link>http://blog.sqlauthority.com/2009/12/15/sql-server-difference-temptable-and-table-variable-temptable-in-memory-a-myth/#comment-327568</link>
		<dc:creator><![CDATA[Rakesh Bhavsar]]></dc:creator>
		<pubDate>Thu, 09 Aug 2012 06:42:07 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=7544#comment-327568</guid>
		<description><![CDATA[Hi Pinal,
If I have created one temporary table #table1 in one stored procedure in sql having some input variables. 
If multiple user executes this then is #table1 created twice time in TempDB or created only once. 
If created only once, then can user1 get data of #table1 in which data is inserted by other user.
Please have some reply.]]></description>
		<content:encoded><![CDATA[<p>Hi Pinal,<br />
If I have created one temporary table #table1 in one stored procedure in sql having some input variables.<br />
If multiple user executes this then is #table1 created twice time in TempDB or created only once.<br />
If created only once, then can user1 get data of #table1 in which data is inserted by other user.<br />
Please have some reply.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rashmi</title>
		<link>http://blog.sqlauthority.com/2009/12/15/sql-server-difference-temptable-and-table-variable-temptable-in-memory-a-myth/#comment-308755</link>
		<dc:creator><![CDATA[Rashmi]]></dc:creator>
		<pubDate>Tue, 03 Jul 2012 07:34:04 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=7544#comment-308755</guid>
		<description><![CDATA[Hi Pinal,

Can you correct the heading of your article which says &quot;Temp table in memory a myth&quot;....It should be &quot;Table Variable in memory a myth&quot;]]></description>
		<content:encoded><![CDATA[<p>Hi Pinal,</p>
<p>Can you correct the heading of your article which says &#8220;Temp table in memory a myth&#8221;&#8230;.It should be &#8220;Table Variable in memory a myth&#8221;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: waqar</title>
		<link>http://blog.sqlauthority.com/2009/12/15/sql-server-difference-temptable-and-table-variable-temptable-in-memory-a-myth/#comment-304796</link>
		<dc:creator><![CDATA[waqar]]></dc:creator>
		<pubDate>Sat, 23 Jun 2012 15:30:20 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=7544#comment-304796</guid>
		<description><![CDATA[Hi pinal I run the query of 3000 records ,it gives the same result ,, I want to ask that ,,, is it proved that the great number o f rows can n&#039;t be created in memory?]]></description>
		<content:encoded><![CDATA[<p>Hi pinal I run the query of 3000 records ,it gives the same result ,, I want to ask that ,,, is it proved that the great number o f rows can n&#8217;t be created in memory?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ian</title>
		<link>http://blog.sqlauthority.com/2009/12/15/sql-server-difference-temptable-and-table-variable-temptable-in-memory-a-myth/#comment-303659</link>
		<dc:creator><![CDATA[Ian]]></dc:creator>
		<pubDate>Wed, 20 Jun 2012 18:38:51 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=7544#comment-303659</guid>
		<description><![CDATA[My mind has been blown. Thank you for the article!]]></description>
		<content:encoded><![CDATA[<p>My mind has been blown. Thank you for the article!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Biju Thomas</title>
		<link>http://blog.sqlauthority.com/2009/12/15/sql-server-difference-temptable-and-table-variable-temptable-in-memory-a-myth/#comment-303265</link>
		<dc:creator><![CDATA[Biju Thomas]]></dc:creator>
		<pubDate>Tue, 19 Jun 2012 15:51:08 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=7544#comment-303265</guid>
		<description><![CDATA[Try the following code which shows a new temp table is created every time when the code block is executed

BEGIN
-- Create Table Variable and insert three thousand rows
DECLARE @temp TABLE(Col1 INT)
INSERT INTO @temp (Col1)
SELECT TOP 3000 ROW_NUMBER() OVER(ORDER BY a.name)
FROM sys.all_objects a
CROSS JOIN sys.all_objects b


SELECT * FROM tempdb.sys.objects order by create_date desc
END]]></description>
		<content:encoded><![CDATA[<p>Try the following code which shows a new temp table is created every time when the code block is executed</p>
<p>BEGIN<br />
&#8211; Create Table Variable and insert three thousand rows<br />
DECLARE @temp TABLE(Col1 INT)<br />
INSERT INTO @temp (Col1)<br />
SELECT TOP 3000 ROW_NUMBER() OVER(ORDER BY a.name)<br />
FROM sys.all_objects a<br />
CROSS JOIN sys.all_objects b</p>
<p>SELECT * FROM tempdb.sys.objects order by create_date desc<br />
END</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: balakrishna</title>
		<link>http://blog.sqlauthority.com/2009/12/15/sql-server-difference-temptable-and-table-variable-temptable-in-memory-a-myth/#comment-301925</link>
		<dc:creator><![CDATA[balakrishna]]></dc:creator>
		<pubDate>Sat, 16 Jun 2012 05:30:04 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=7544#comment-301925</guid>
		<description><![CDATA[Temp tables cannot be used in table valued functions where table variables can be used

Temp tables may have indexes added and table variables only can have Primary and unique key constraints as indexes. 

Table variables are dropped at the end of a batch but temp tables are dropped at the end of a session / stored procedure

Table variables are not transactional and do not roll back. temp tables are transactional and do roll back.

Temp tables are visible to called procedures but table variables

Query optimizer always assumes that one row is returned from a table variable. Temp tables with indexes have statistics that generate better plans.]]></description>
		<content:encoded><![CDATA[<p>Temp tables cannot be used in table valued functions where table variables can be used</p>
<p>Temp tables may have indexes added and table variables only can have Primary and unique key constraints as indexes. </p>
<p>Table variables are dropped at the end of a batch but temp tables are dropped at the end of a session / stored procedure</p>
<p>Table variables are not transactional and do not roll back. temp tables are transactional and do roll back.</p>
<p>Temp tables are visible to called procedures but table variables</p>
<p>Query optimizer always assumes that one row is returned from a table variable. Temp tables with indexes have statistics that generate better plans.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Amit Srivastava</title>
		<link>http://blog.sqlauthority.com/2009/12/15/sql-server-difference-temptable-and-table-variable-temptable-in-memory-a-myth/#comment-296249</link>
		<dc:creator><![CDATA[Amit Srivastava]]></dc:creator>
		<pubDate>Thu, 07 Jun 2012 11:12:26 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=7544#comment-296249</guid>
		<description><![CDATA[Hi,
I have one query over here, when i created Temp Table and insert records, the user_objects_alloc_page_count comes out to be 10, when i drop the table, again it shows 10 against user_objects_alloc_page_count. It should come back to 4 as it was initially ...please throw light on this..]]></description>
		<content:encoded><![CDATA[<p>Hi,<br />
I have one query over here, when i created Temp Table and insert records, the user_objects_alloc_page_count comes out to be 10, when i drop the table, again it shows 10 against user_objects_alloc_page_count. It should come back to 4 as it was initially &#8230;please throw light on this..</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kamlesh</title>
		<link>http://blog.sqlauthority.com/2009/12/15/sql-server-difference-temptable-and-table-variable-temptable-in-memory-a-myth/#comment-271951</link>
		<dc:creator><![CDATA[Kamlesh]]></dc:creator>
		<pubDate>Wed, 04 Apr 2012 14:32:46 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=7544#comment-271951</guid>
		<description><![CDATA[Sir in above code i want to create permanant table is it possible because every time their will be new name as per my table columns]]></description>
		<content:encoded><![CDATA[<p>Sir in above code i want to create permanant table is it possible because every time their will be new name as per my table columns</p>
]]></content:encoded>
	</item>
</channel>
</rss>
