<?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; 2005 &#8211; OUTPUT Clause Example and Explanation with INSERT, UPDATE, DELETE</title>
	<atom:link href="http://blog.sqlauthority.com/2007/10/01/sql-server-2005-output-clause-example-and-explanation-with-insert-update-delete/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.sqlauthority.com/2007/10/01/sql-server-2005-output-clause-example-and-explanation-with-insert-update-delete/</link>
	<description>Personal Notes of Pinal Dave</description>
	<lastBuildDate>Mon, 13 Feb 2012 15:11:24 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: Jason R</title>
		<link>http://blog.sqlauthority.com/2007/10/01/sql-server-2005-output-clause-example-and-explanation-with-insert-update-delete/#comment-250995</link>
		<dc:creator><![CDATA[Jason R]]></dc:creator>
		<pubDate>Fri, 10 Feb 2012 16:00:37 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/10/01/sql-server-2005-output-clause-example-and-explanation-with-insert-update-delete/#comment-250995</guid>
		<description><![CDATA[Todd,

Was your question ever answered?  I am having the same issue.  Is there a simple way to do this with the output clause?]]></description>
		<content:encoded><![CDATA[<p>Todd,</p>
<p>Was your question ever answered?  I am having the same issue.  Is there a simple way to do this with the output clause?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mahesh Patel</title>
		<link>http://blog.sqlauthority.com/2007/10/01/sql-server-2005-output-clause-example-and-explanation-with-insert-update-delete/#comment-240246</link>
		<dc:creator><![CDATA[Mahesh Patel]]></dc:creator>
		<pubDate>Wed, 18 Jan 2012 14:00:15 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/10/01/sql-server-2005-output-clause-example-and-explanation-with-insert-update-delete/#comment-240246</guid>
		<description><![CDATA[TestTable has 3 Fields but only 2 Values in Values Clause. There needs 3 values.]]></description>
		<content:encoded><![CDATA[<p>TestTable has 3 Fields but only 2 Values in Values Clause. There needs 3 values.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SQL SERVER &#8211; Reasons for Using Output Clause &#8211; Quiz &#8211; Puzzle &#8211; 10 of 31 &#171; SQL Server Journey with SQL Authority</title>
		<link>http://blog.sqlauthority.com/2007/10/01/sql-server-2005-output-clause-example-and-explanation-with-insert-update-delete/#comment-235030</link>
		<dc:creator><![CDATA[SQL SERVER &#8211; Reasons for Using Output Clause &#8211; Quiz &#8211; Puzzle &#8211; 10 of 31 &#171; SQL Server Journey with SQL Authority]]></dc:creator>
		<pubDate>Wed, 11 Jan 2012 01:31:58 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/10/01/sql-server-2005-output-clause-example-and-explanation-with-insert-update-delete/#comment-235030</guid>
		<description><![CDATA[[...] SQL Server Interview Questions and Answers ISBN: 1466405643 Page#63 OUTPUT Clause Example and Explanation with INSERT, UPDATE, DELETE [...]]]></description>
		<content:encoded><![CDATA[<p>[...] SQL Server Interview Questions and Answers ISBN: 1466405643 Page#63 OUTPUT Clause Example and Explanation with INSERT, UPDATE, DELETE [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Megha Goyal</title>
		<link>http://blog.sqlauthority.com/2007/10/01/sql-server-2005-output-clause-example-and-explanation-with-insert-update-delete/#comment-191323</link>
		<dc:creator><![CDATA[Megha Goyal]]></dc:creator>
		<pubDate>Wed, 09 Nov 2011 04:46:01 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/10/01/sql-server-2005-output-clause-example-and-explanation-with-insert-update-delete/#comment-191323</guid>
		<description><![CDATA[Hi Pinal,

Very nice article in simple words... Thanks for the explanation but i would like to know what if a table has a trigger attached??

Will these magic table return the values from trigger or from the table that is been updated?]]></description>
		<content:encoded><![CDATA[<p>Hi Pinal,</p>
<p>Very nice article in simple words&#8230; Thanks for the explanation but i would like to know what if a table has a trigger attached??</p>
<p>Will these magic table return the values from trigger or from the table that is been updated?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kavitha</title>
		<link>http://blog.sqlauthority.com/2007/10/01/sql-server-2005-output-clause-example-and-explanation-with-insert-update-delete/#comment-177090</link>
		<dc:creator><![CDATA[Kavitha]]></dc:creator>
		<pubDate>Mon, 10 Oct 2011 08:13:51 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/10/01/sql-server-2005-output-clause-example-and-explanation-with-insert-update-delete/#comment-177090</guid>
		<description><![CDATA[I m getting error of DBNETLIB with the error message &#039;General network error.  before i never faced such error. sometimes the error is &#039;communication link failure&#039;.

the errors are generated while using application based on VB and SQL on client machines.

It is not that the error prompts only when huge query is fired from client. the error prompt even just application is open on the client machine and client is not doing anything.



first of all please any one could help to understand the possible reasons for this error. i have searched on MS sites and also gooled. As per the explanation given all settings are correct on server... but not yet clear....

AWE is not enabled on SQL server.... SP4 is installed...chimney setting is proper...

is this machine specific error? any hot fix is required after installing SP4?
there might be LAN problem?

Early help would be appreciated.

Thanks in advance.]]></description>
		<content:encoded><![CDATA[<p>I m getting error of DBNETLIB with the error message &#8216;General network error.  before i never faced such error. sometimes the error is &#8216;communication link failure&#8217;.</p>
<p>the errors are generated while using application based on VB and SQL on client machines.</p>
<p>It is not that the error prompts only when huge query is fired from client. the error prompt even just application is open on the client machine and client is not doing anything.</p>
<p>first of all please any one could help to understand the possible reasons for this error. i have searched on MS sites and also gooled. As per the explanation given all settings are correct on server&#8230; but not yet clear&#8230;.</p>
<p>AWE is not enabled on SQL server&#8230;. SP4 is installed&#8230;chimney setting is proper&#8230;</p>
<p>is this machine specific error? any hot fix is required after installing SP4?<br />
there might be LAN problem?</p>
<p>Early help would be appreciated.</p>
<p>Thanks in advance.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Guillermo</title>
		<link>http://blog.sqlauthority.com/2007/10/01/sql-server-2005-output-clause-example-and-explanation-with-insert-update-delete/#comment-166938</link>
		<dc:creator><![CDATA[Guillermo]]></dc:creator>
		<pubDate>Fri, 09 Sep 2011 23:23:10 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/10/01/sql-server-2005-output-clause-example-and-explanation-with-insert-update-delete/#comment-166938</guid>
		<description><![CDATA[It is possible to make a select from a delete&#039;s output?]]></description>
		<content:encoded><![CDATA[<p>It is possible to make a select from a delete&#8217;s output?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: nishad</title>
		<link>http://blog.sqlauthority.com/2007/10/01/sql-server-2005-output-clause-example-and-explanation-with-insert-update-delete/#comment-166278</link>
		<dc:creator><![CDATA[nishad]]></dc:creator>
		<pubDate>Wed, 07 Sep 2011 16:48:43 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/10/01/sql-server-2005-output-clause-example-and-explanation-with-insert-update-delete/#comment-166278</guid>
		<description><![CDATA[hi all,
we are doing migration from sybase to mssql.

can anyone suggest how can normal user can access all records in syslogins table. user should not be security admin. 

I am thinking to retrieve all records from syslogins with priviledge login into user table and then use user table]]></description>
		<content:encoded><![CDATA[<p>hi all,<br />
we are doing migration from sybase to mssql.</p>
<p>can anyone suggest how can normal user can access all records in syslogins table. user should not be security admin. </p>
<p>I am thinking to retrieve all records from syslogins with priviledge login into user table and then use user table</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: madhivanan</title>
		<link>http://blog.sqlauthority.com/2007/10/01/sql-server-2005-output-clause-example-and-explanation-with-insert-update-delete/#comment-166253</link>
		<dc:creator><![CDATA[madhivanan]]></dc:creator>
		<pubDate>Wed, 07 Sep 2011 14:00:10 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/10/01/sql-server-2005-output-clause-example-and-explanation-with-insert-update-delete/#comment-166253</guid>
		<description><![CDATA[Becuase output clause is not supported in versions prior to 2005]]></description>
		<content:encoded><![CDATA[<p>Becuase output clause is not supported in versions prior to 2005</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: kalaikumar</title>
		<link>http://blog.sqlauthority.com/2007/10/01/sql-server-2005-output-clause-example-and-explanation-with-insert-update-delete/#comment-166160</link>
		<dc:creator><![CDATA[kalaikumar]]></dc:creator>
		<pubDate>Wed, 07 Sep 2011 07:03:13 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/10/01/sql-server-2005-output-clause-example-and-explanation-with-insert-update-delete/#comment-166160</guid>
		<description><![CDATA[In sql server 2000 this code is not working can you tel me what is the problem in this....]]></description>
		<content:encoded><![CDATA[<p>In sql server 2000 this code is not working can you tel me what is the problem in this&#8230;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dilip Mevada</title>
		<link>http://blog.sqlauthority.com/2007/10/01/sql-server-2005-output-clause-example-and-explanation-with-insert-update-delete/#comment-137560</link>
		<dc:creator><![CDATA[Dilip Mevada]]></dc:creator>
		<pubDate>Mon, 30 May 2011 08:34:36 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/10/01/sql-server-2005-output-clause-example-and-explanation-with-insert-update-delete/#comment-137560</guid>
		<description><![CDATA[Very good explanation, nice article.

Thanks.]]></description>
		<content:encoded><![CDATA[<p>Very good explanation, nice article.</p>
<p>Thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sddesh01</title>
		<link>http://blog.sqlauthority.com/2007/10/01/sql-server-2005-output-clause-example-and-explanation-with-insert-update-delete/#comment-119013</link>
		<dc:creator><![CDATA[sddesh01]]></dc:creator>
		<pubDate>Thu, 17 Feb 2011 19:26:21 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/10/01/sql-server-2005-output-clause-example-and-explanation-with-insert-update-delete/#comment-119013</guid>
		<description><![CDATA[Pinal, It&#039;s a great solution and we have used it. Recently we had some cross server(remote) queries. I tried it this on a remote server and its is saying &quot;a remote table cannot be used as a DML target in a statement which includes output caluse or nested DML statement&quot;. How could it be used with a remote server?]]></description>
		<content:encoded><![CDATA[<p>Pinal, It&#8217;s a great solution and we have used it. Recently we had some cross server(remote) queries. I tried it this on a remote server and its is saying &#8220;a remote table cannot be used as a DML target in a statement which includes output caluse or nested DML statement&#8221;. How could it be used with a remote server?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: nishad</title>
		<link>http://blog.sqlauthority.com/2007/10/01/sql-server-2005-output-clause-example-and-explanation-with-insert-update-delete/#comment-109314</link>
		<dc:creator><![CDATA[nishad]]></dc:creator>
		<pubDate>Mon, 03 Jan 2011 12:38:57 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/10/01/sql-server-2005-output-clause-example-and-explanation-with-insert-update-delete/#comment-109314</guid>
		<description><![CDATA[Hi Pinal,

Your Post on Output clause ...helped me.

Thanks.]]></description>
		<content:encoded><![CDATA[<p>Hi Pinal,</p>
<p>Your Post on Output clause &#8230;helped me.</p>
<p>Thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sourov Chat</title>
		<link>http://blog.sqlauthority.com/2007/10/01/sql-server-2005-output-clause-example-and-explanation-with-insert-update-delete/#comment-63110</link>
		<dc:creator><![CDATA[Sourov Chat]]></dc:creator>
		<pubDate>Wed, 17 Mar 2010 16:59:56 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/10/01/sql-server-2005-output-clause-example-and-explanation-with-insert-update-delete/#comment-63110</guid>
		<description><![CDATA[Any help on the above query is appriciated.

Thanks,

Sourov]]></description>
		<content:encoded><![CDATA[<p>Any help on the above query is appriciated.</p>
<p>Thanks,</p>
<p>Sourov</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sourov Chat</title>
		<link>http://blog.sqlauthority.com/2007/10/01/sql-server-2005-output-clause-example-and-explanation-with-insert-update-delete/#comment-62679</link>
		<dc:creator><![CDATA[Sourov Chat]]></dc:creator>
		<pubDate>Wed, 10 Mar 2010 21:03:06 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/10/01/sql-server-2005-output-clause-example-and-explanation-with-insert-update-delete/#comment-62679</guid>
		<description><![CDATA[Pinal ,

output clause is great when we need to do secondary jobs on all or subset of the columns being inserted in the main table. But, how can we update two tables with no overlapping columns other than a common pk column (e.g. specialization &amp; generalization tables). My idea is to update both the tables in one read of a temp table and update two tables at one go. here is the DML that fails.

INSERT INTO payout ( 
   -- payout_id (identity column),
 payoutType_id,Start_Date	
)
OUTPUT INSERTED.payout_id , source 
INTO payoutBonus(payout_id,source)
SELECT payoutType_id,Start_Date, source 
FROM @temp_payout_table

Thanks

Sourov]]></description>
		<content:encoded><![CDATA[<p>Pinal ,</p>
<p>output clause is great when we need to do secondary jobs on all or subset of the columns being inserted in the main table. But, how can we update two tables with no overlapping columns other than a common pk column (e.g. specialization &amp; generalization tables). My idea is to update both the tables in one read of a temp table and update two tables at one go. here is the DML that fails.</p>
<p>INSERT INTO payout (<br />
   &#8212; payout_id (identity column),<br />
 payoutType_id,Start_Date<br />
)<br />
OUTPUT INSERTED.payout_id , source<br />
INTO payoutBonus(payout_id,source)<br />
SELECT payoutType_id,Start_Date, source<br />
FROM @temp_payout_table</p>
<p>Thanks</p>
<p>Sourov</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tim</title>
		<link>http://blog.sqlauthority.com/2007/10/01/sql-server-2005-output-clause-example-and-explanation-with-insert-update-delete/#comment-62188</link>
		<dc:creator><![CDATA[Tim]]></dc:creator>
		<pubDate>Thu, 04 Mar 2010 16:13:18 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/10/01/sql-server-2005-output-clause-example-and-explanation-with-insert-update-delete/#comment-62188</guid>
		<description><![CDATA[Pinal,

I have a application that is multi-threaded that is doing hundreds of inserts a minute.   I want to use the OUTPUT clause to return me the identity field from each insert.  

Have you seen any problems where with getting the unique identity field back for a given insert when hundreds of inserts are being execute at the same time.

Thanks Tim]]></description>
		<content:encoded><![CDATA[<p>Pinal,</p>
<p>I have a application that is multi-threaded that is doing hundreds of inserts a minute.   I want to use the OUTPUT clause to return me the identity field from each insert.  </p>
<p>Have you seen any problems where with getting the unique identity field back for a given insert when hundreds of inserts are being execute at the same time.</p>
<p>Thanks Tim</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: 577473</title>
		<link>http://blog.sqlauthority.com/2007/10/01/sql-server-2005-output-clause-example-and-explanation-with-insert-update-delete/#comment-59127</link>
		<dc:creator><![CDATA[577473]]></dc:creator>
		<pubDate>Wed, 30 Dec 2009 07:52:52 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/10/01/sql-server-2005-output-clause-example-and-explanation-with-insert-update-delete/#comment-59127</guid>
		<description><![CDATA[Hi, i was looking for what you showed in example 2, for like 3 hours... tenths of websites.

I needed it for my identity, since scope_identity() is bugged.

with your help plus something i read elsewhere now i can retrieve the identity i needed back to my code, and use it with my typed dataset and adapters.

[For Reference]
I just created a query for my table adapter with my equivalent for example 2, and then in the method properties, changed execute mode from NonQuery to Scalar. That way the method returns the new identity (Convert needed).
--------------

Thanks a lot.]]></description>
		<content:encoded><![CDATA[<p>Hi, i was looking for what you showed in example 2, for like 3 hours&#8230; tenths of websites.</p>
<p>I needed it for my identity, since scope_identity() is bugged.</p>
<p>with your help plus something i read elsewhere now i can retrieve the identity i needed back to my code, and use it with my typed dataset and adapters.</p>
<p>[For Reference]<br />
I just created a query for my table adapter with my equivalent for example 2, and then in the method properties, changed execute mode from NonQuery to Scalar. That way the method returns the new identity (Convert needed).<br />
&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>Thanks a lot.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Praveen Agrawal</title>
		<link>http://blog.sqlauthority.com/2007/10/01/sql-server-2005-output-clause-example-and-explanation-with-insert-update-delete/#comment-54778</link>
		<dc:creator><![CDATA[Praveen Agrawal]]></dc:creator>
		<pubDate>Wed, 12 Aug 2009 11:40:51 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/10/01/sql-server-2005-output-clause-example-and-explanation-with-insert-update-delete/#comment-54778</guid>
		<description><![CDATA[Hi Ajit,

 u can insert AutoID value to temp table, use following code,

--Creating a TestTable
CREATE TABLE TestTable (AutoID INT IDENTITY(1,1),ID INT, TEXTVal VARCHAR(100))
--Creating a Temp Table
DECLARE @TmpTable TABLE (AutoID INT,ID INT, TEXTVal VARCHAR(100))

--Insert  value in TestTable and get value in Temp Table 
INSERT TestTable (ID, TEXTVal)
OUTPUT Inserted.AutoID,Inserted.ID, Inserted.TEXTVal INTO @TmpTable
VALUES (1,&#039;FirstVal&#039;)

INSERT TestTable (ID, TEXTVal)
OUTPUT Inserted.AutoID,Inserted.ID, Inserted.TEXTVal INTO @TmpTable
VALUES (2,&#039;SecondVal&#039;)

select * from @TmpTable

AutoID	ID	TEXTVal
1	       1	 FirstVal
2	       2	SecondVal

--------------------------------------------------------------

we can&#039;t  Give The Autogenrate Column name in insert column, like insert TestTable(AutoID) that is wrong.


Thanks 

Praveen Agrawal]]></description>
		<content:encoded><![CDATA[<p>Hi Ajit,</p>
<p> u can insert AutoID value to temp table, use following code,</p>
<p>&#8211;Creating a TestTable<br />
CREATE TABLE TestTable (AutoID INT IDENTITY(1,1),ID INT, TEXTVal VARCHAR(100))<br />
&#8211;Creating a Temp Table<br />
DECLARE @TmpTable TABLE (AutoID INT,ID INT, TEXTVal VARCHAR(100))</p>
<p>&#8211;Insert  value in TestTable and get value in Temp Table<br />
INSERT TestTable (ID, TEXTVal)<br />
OUTPUT Inserted.AutoID,Inserted.ID, Inserted.TEXTVal INTO @TmpTable<br />
VALUES (1,&#8217;FirstVal&#8217;)</p>
<p>INSERT TestTable (ID, TEXTVal)<br />
OUTPUT Inserted.AutoID,Inserted.ID, Inserted.TEXTVal INTO @TmpTable<br />
VALUES (2,&#8217;SecondVal&#8217;)</p>
<p>select * from @TmpTable</p>
<p>AutoID	ID	TEXTVal<br />
1	       1	 FirstVal<br />
2	       2	SecondVal</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>we can&#8217;t  Give The Autogenrate Column name in insert column, like insert TestTable(AutoID) that is wrong.</p>
<p>Thanks </p>
<p>Praveen Agrawal</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ajith</title>
		<link>http://blog.sqlauthority.com/2007/10/01/sql-server-2005-output-clause-example-and-explanation-with-insert-update-delete/#comment-54053</link>
		<dc:creator><![CDATA[Ajith]]></dc:creator>
		<pubDate>Fri, 24 Jul 2009 08:03:20 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/10/01/sql-server-2005-output-clause-example-and-explanation-with-insert-update-delete/#comment-54053</guid>
		<description><![CDATA[Hi ,
         We can&#039;t insert AutoID values to temp table? I tried following, but giving errors, 
-----------------------
CREATE TABLE TestTable (AutoID INT IDENTITY(1,1),ID INT, TEXTVal VARCHAR(100))
----Creating temp table to store ovalues of OUTPUT clause
DECLARE @TmpTable TABLE (AutoID INT,ID INT, TEXTVal VARCHAR(100))
----Insert values in real table as well use OUTPUT clause to insert
----values in the temp table.
INSERT TestTable (AutoID,ID, TEXTVal)
OUTPUT Inserted.AutoID,Inserted.ID, Inserted.TEXTVal INTO @TmpTable
VALUES (1,&#039;FirstVal&#039;)
INSERT TestTable (AutoID,ID, TEXTVal)
OUTPUT Inserted.AutoID,Inserted.ID, Inserted.TEXTVal INTO @TmpTable
VALUES (2,&#039;SecondVal&#039;)
----Check the values in the temp table and real table
----The values in both the tables will be same
SELECT * FROM @TmpTable
SELECT * FROM TestTable
----Clean up time
DROP TABLE TestTable
--------------------------

Thanks
Ajith]]></description>
		<content:encoded><![CDATA[<p>Hi ,<br />
         We can&#8217;t insert AutoID values to temp table? I tried following, but giving errors,<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
CREATE TABLE TestTable (AutoID INT IDENTITY(1,1),ID INT, TEXTVal VARCHAR(100))<br />
&#8212;-Creating temp table to store ovalues of OUTPUT clause<br />
DECLARE @TmpTable TABLE (AutoID INT,ID INT, TEXTVal VARCHAR(100))<br />
&#8212;-Insert values in real table as well use OUTPUT clause to insert<br />
&#8212;-values in the temp table.<br />
INSERT TestTable (AutoID,ID, TEXTVal)<br />
OUTPUT Inserted.AutoID,Inserted.ID, Inserted.TEXTVal INTO @TmpTable<br />
VALUES (1,&#8217;FirstVal&#8217;)<br />
INSERT TestTable (AutoID,ID, TEXTVal)<br />
OUTPUT Inserted.AutoID,Inserted.ID, Inserted.TEXTVal INTO @TmpTable<br />
VALUES (2,&#8217;SecondVal&#8217;)<br />
&#8212;-Check the values in the temp table and real table<br />
&#8212;-The values in both the tables will be same<br />
SELECT * FROM @TmpTable<br />
SELECT * FROM TestTable<br />
&#8212;-Clean up time<br />
DROP TABLE TestTable<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>Thanks<br />
Ajith</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ajith</title>
		<link>http://blog.sqlauthority.com/2007/10/01/sql-server-2005-output-clause-example-and-explanation-with-insert-update-delete/#comment-54052</link>
		<dc:creator><![CDATA[Ajith]]></dc:creator>
		<pubDate>Fri, 24 Jul 2009 07:39:59 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/10/01/sql-server-2005-output-clause-example-and-explanation-with-insert-update-delete/#comment-54052</guid>
		<description><![CDATA[Hi pinaldave,
         This is really good post. Can we use these things inside a transaction as well?
Thanks
Ajith]]></description>
		<content:encoded><![CDATA[<p>Hi pinaldave,<br />
         This is really good post. Can we use these things inside a transaction as well?<br />
Thanks<br />
Ajith</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SQL SERVER - 2008 - SCOPE_IDENTITY Bug with Multi Processor Parallel Plan and Solution Journey to SQL Authority with Pinal Dave</title>
		<link>http://blog.sqlauthority.com/2007/10/01/sql-server-2005-output-clause-example-and-explanation-with-insert-update-delete/#comment-49808</link>
		<dc:creator><![CDATA[SQL SERVER - 2008 - SCOPE_IDENTITY Bug with Multi Processor Parallel Plan and Solution Journey to SQL Authority with Pinal Dave]]></dc:creator>
		<pubDate>Tue, 24 Mar 2009 01:32:11 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/10/01/sql-server-2005-output-clause-example-and-explanation-with-insert-update-delete/#comment-49808</guid>
		<description><![CDATA[[...] clause: (Preferred Method) Refer my previous article for how to use OUTPUT clause information : SQL SERVER - 2005 - OUTPUT Clause Example and Explanation with INSERT, UPDATE, DELETE.I have included the same example along with this article for quick [...]]]></description>
		<content:encoded><![CDATA[<p>[...] clause: (Preferred Method) Refer my previous article for how to use OUTPUT clause information : SQL SERVER &#8211; 2005 &#8211; OUTPUT Clause Example and Explanation with INSERT, UPDATE, DELETE.I have included the same example along with this article for quick [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SQLAuthority News - Best Articles on SQLAuthority.com Journey to SQL Authority with Pinal Dave</title>
		<link>http://blog.sqlauthority.com/2007/10/01/sql-server-2005-output-clause-example-and-explanation-with-insert-update-delete/#comment-47252</link>
		<dc:creator><![CDATA[SQLAuthority News - Best Articles on SQLAuthority.com Journey to SQL Authority with Pinal Dave]]></dc:creator>
		<pubDate>Tue, 24 Feb 2009 12:11:05 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/10/01/sql-server-2005-output-clause-example-and-explanation-with-insert-update-delete/#comment-47252</guid>
		<description><![CDATA[[...] SQL SERVER - 2005 - OUTPUT Clause Example and Explanation with INSERT, UPDATE, DELETE [...]]]></description>
		<content:encoded><![CDATA[<p>[...] SQL SERVER &#8211; 2005 &#8211; OUTPUT Clause Example and Explanation with INSERT, UPDATE, DELETE [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Todd M</title>
		<link>http://blog.sqlauthority.com/2007/10/01/sql-server-2005-output-clause-example-and-explanation-with-insert-update-delete/#comment-46982</link>
		<dc:creator><![CDATA[Todd M]]></dc:creator>
		<pubDate>Fri, 20 Feb 2009 21:56:48 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/10/01/sql-server-2005-output-clause-example-and-explanation-with-insert-update-delete/#comment-46982</guid>
		<description><![CDATA[Hi,
Thought I&#039;d ask an expert this question. I sometimes have the need to do deep-copies involving multiple tables where I need to maintain a mapping between IDs of rows being copied from and IDs of the new rows. I usually have to resort to doing the inserts one by one using cursors in order to maintain these mappings, but I thought the OUTPUT clause might allow me to do it in sets. But now I&#039;m not so sure I can get that &quot;from&quot; ID. Below is a simplification of what I&#039;d like to do:

INSERT Thing (Name)
OUTPUT Inserted.ID AS ToID, ??? AS FromID
SELECT Name
FROM Thing
WHERE ...

I can&#039;t get this to work because it seems that INSERTED columns are the only ones I can output, and hence I can&#039;t get the from ID. Can you confirm that this is correct? Thank you very much for your help.]]></description>
		<content:encoded><![CDATA[<p>Hi,<br />
Thought I&#8217;d ask an expert this question. I sometimes have the need to do deep-copies involving multiple tables where I need to maintain a mapping between IDs of rows being copied from and IDs of the new rows. I usually have to resort to doing the inserts one by one using cursors in order to maintain these mappings, but I thought the OUTPUT clause might allow me to do it in sets. But now I&#8217;m not so sure I can get that &#8220;from&#8221; ID. Below is a simplification of what I&#8217;d like to do:</p>
<p>INSERT Thing (Name)<br />
OUTPUT Inserted.ID AS ToID, ??? AS FromID<br />
SELECT Name<br />
FROM Thing<br />
WHERE &#8230;</p>
<p>I can&#8217;t get this to work because it seems that INSERTED columns are the only ones I can output, and hence I can&#8217;t get the from ID. Can you confirm that this is correct? Thank you very much for your help.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sameer</title>
		<link>http://blog.sqlauthority.com/2007/10/01/sql-server-2005-output-clause-example-and-explanation-with-insert-update-delete/#comment-45068</link>
		<dc:creator><![CDATA[Sameer]]></dc:creator>
		<pubDate>Wed, 24 Dec 2008 21:07:24 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/10/01/sql-server-2005-output-clause-example-and-explanation-with-insert-update-delete/#comment-45068</guid>
		<description><![CDATA[I mean copy dept1 in TABLE B]]></description>
		<content:encoded><![CDATA[<p>I mean copy dept1 in TABLE B</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sameer</title>
		<link>http://blog.sqlauthority.com/2007/10/01/sql-server-2005-output-clause-example-and-explanation-with-insert-update-delete/#comment-45067</link>
		<dc:creator><![CDATA[Sameer]]></dc:creator>
		<pubDate>Wed, 24 Dec 2008 21:06:19 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/10/01/sql-server-2005-output-clause-example-and-explanation-with-insert-update-delete/#comment-45067</guid>
		<description><![CDATA[Hi pinal,
I ejoy reading your blog as its neat and gives me a exact solution,

I am stumbled upon a small problem..

I have two tables which i want to update but the table B has a foreingn key in Table A which is Identity column,

Now if i do a single insert i am fine with output clause but how do i tackle a multiple insert.

Eg: table A Empid,Empname,deptid
table B, deptid,deptname,

now If i want to copy dept1 and insert into table B
Say dept1 has 100 employees,
My requirement is COPY the whole department with employees and create a duplicate dept in Table A
how do i do it. please help]]></description>
		<content:encoded><![CDATA[<p>Hi pinal,<br />
I ejoy reading your blog as its neat and gives me a exact solution,</p>
<p>I am stumbled upon a small problem..</p>
<p>I have two tables which i want to update but the table B has a foreingn key in Table A which is Identity column,</p>
<p>Now if i do a single insert i am fine with output clause but how do i tackle a multiple insert.</p>
<p>Eg: table A Empid,Empname,deptid<br />
table B, deptid,deptname,</p>
<p>now If i want to copy dept1 and insert into table B<br />
Say dept1 has 100 employees,<br />
My requirement is COPY the whole department with employees and create a duplicate dept in Table A<br />
how do i do it. please help</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sukitha</title>
		<link>http://blog.sqlauthority.com/2007/10/01/sql-server-2005-output-clause-example-and-explanation-with-insert-update-delete/#comment-45049</link>
		<dc:creator><![CDATA[Sukitha]]></dc:creator>
		<pubDate>Wed, 24 Dec 2008 05:12:35 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/10/01/sql-server-2005-output-clause-example-and-explanation-with-insert-update-delete/#comment-45049</guid>
		<description><![CDATA[hi every one,
i need a help. i want to connect more than 30 database at the time to view the datails for the chairman of our group of company. if you know the coding please help me. 
thank you
Sukitha]]></description>
		<content:encoded><![CDATA[<p>hi every one,<br />
i need a help. i want to connect more than 30 database at the time to view the datails for the chairman of our group of company. if you know the coding please help me.<br />
thank you<br />
Sukitha</p>
]]></content:encoded>
	</item>
</channel>
</rss>

