<?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; Find Current Identity of Table</title>
	<atom:link href="http://blog.sqlauthority.com/2008/06/20/sql-server-find-current-identity-of-table/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.sqlauthority.com/2008/06/20/sql-server-find-current-identity-of-table/</link>
	<description>Personal Notes of Pinal Dave</description>
	<lastBuildDate>Thu, 09 Feb 2012 10:31:47 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: Vedran</title>
		<link>http://blog.sqlauthority.com/2008/06/20/sql-server-find-current-identity-of-table/#comment-175328</link>
		<dc:creator><![CDATA[Vedran]]></dc:creator>
		<pubDate>Wed, 05 Oct 2011 10:06:16 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=653#comment-175328</guid>
		<description><![CDATA[@@Identity should never be used. Even IDENT_CURRENT() is not recommended, since other transactions can insert rows in the meantime. Use SCOPE_IDENTITY() to retrieve identity value of a row just inserted. If there is more than one row, use SCOPE_IDENTITY() in compination with OUTPUT clause to collect all ID&#039;s. Using sequence objects in Denali is another possible option. Here is complete example for OUTPUT clause:

DROP TABLE t
CREATE TABLE t(x int IDENTITY(1,1), y int)

DECLARE @TableOfInsertedIds TABLE ( id int )

INSERT INTO t( y ) -- inserts into &quot;t&quot;
OUTPUT INSERTED.x INTO @TableOfInsertedIds( id ) -- this populates our table variable
SELECT TOP 10 object_id FROM sys.all_objects

SELECT * FROM t
SELECT * FROM @TableOfInsertedIds]]></description>
		<content:encoded><![CDATA[<p>@@Identity should never be used. Even IDENT_CURRENT() is not recommended, since other transactions can insert rows in the meantime. Use SCOPE_IDENTITY() to retrieve identity value of a row just inserted. If there is more than one row, use SCOPE_IDENTITY() in compination with OUTPUT clause to collect all ID&#8217;s. Using sequence objects in Denali is another possible option. Here is complete example for OUTPUT clause:</p>
<p>DROP TABLE t<br />
CREATE TABLE t(x int IDENTITY(1,1), y int)</p>
<p>DECLARE @TableOfInsertedIds TABLE ( id int )</p>
<p>INSERT INTO t( y ) &#8212; inserts into &#8220;t&#8221;<br />
OUTPUT INSERTED.x INTO @TableOfInsertedIds( id ) &#8212; this populates our table variable<br />
SELECT TOP 10 object_id FROM sys.all_objects</p>
<p>SELECT * FROM t<br />
SELECT * FROM @TableOfInsertedIds</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Saud</title>
		<link>http://blog.sqlauthority.com/2008/06/20/sql-server-find-current-identity-of-table/#comment-43806</link>
		<dc:creator><![CDATA[Saud]]></dc:creator>
		<pubDate>Mon, 20 Oct 2008 04:59:58 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=653#comment-43806</guid>
		<description><![CDATA[@@Identity will not work. it will give the the last identity inserted in a transaction. i ll go with krishna.]]></description>
		<content:encoded><![CDATA[<p>@@Identity will not work. it will give the the last identity inserted in a transaction. i ll go with krishna.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rajesh</title>
		<link>http://blog.sqlauthority.com/2008/06/20/sql-server-find-current-identity-of-table/#comment-43458</link>
		<dc:creator><![CDATA[Rajesh]]></dc:creator>
		<pubDate>Thu, 02 Oct 2008 18:43:31 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=653#comment-43458</guid>
		<description><![CDATA[or we can use @@identity]]></description>
		<content:encoded><![CDATA[<p>or we can use @@identity</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Krishna</title>
		<link>http://blog.sqlauthority.com/2008/06/20/sql-server-find-current-identity-of-table/#comment-40691</link>
		<dc:creator><![CDATA[Krishna]]></dc:creator>
		<pubDate>Wed, 23 Jul 2008 11:14:48 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=653#comment-40691</guid>
		<description><![CDATA[even SELECT IDENT_CURRENT(&#039;table name&#039;) gives the desired results]]></description>
		<content:encoded><![CDATA[<p>even SELECT IDENT_CURRENT(&#8216;table name&#8217;) gives the desired results</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Smitha</title>
		<link>http://blog.sqlauthority.com/2008/06/20/sql-server-find-current-identity-of-table/#comment-39844</link>
		<dc:creator><![CDATA[Smitha]]></dc:creator>
		<pubDate>Mon, 07 Jul 2008 06:47:24 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=653#comment-39844</guid>
		<description><![CDATA[hi,

i tried it but it gives me error.
but when i am just giving the table name it gives the correct result

i think it should be like this

USE Name_Of_The_DB
GO
DBCC CHECKIDENT (‘Name_Of_The_Table’)
GO

please check as when i given the column name it gives me error
 
What is Person.Address???
i didnot get it plz help...........]]></description>
		<content:encoded><![CDATA[<p>hi,</p>
<p>i tried it but it gives me error.<br />
but when i am just giving the table name it gives the correct result</p>
<p>i think it should be like this</p>
<p>USE Name_Of_The_DB<br />
GO<br />
DBCC CHECKIDENT (‘Name_Of_The_Table’)<br />
GO</p>
<p>please check as when i given the column name it gives me error</p>
<p>What is Person.Address???<br />
i didnot get it plz help&#8230;&#8230;&#8230;..</p>
]]></content:encoded>
	</item>
</channel>
</rss>

