<?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; Reseting Identity Values for All Tables</title>
	<atom:link href="http://blog.sqlauthority.com/2012/08/23/sql-server-reseting-identity-values-for-all-tables/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.sqlauthority.com/2012/08/23/sql-server-reseting-identity-values-for-all-tables/</link>
	<description>SQL, SQL Server, MySQL, Big Data and NoSQL</description>
	<lastBuildDate>Wed, 19 Jun 2013 15:04:54 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: SQL SERVER &#8211; RESEED Identity Column in Database Table &#8211; Rest Table Identity Value &#8211; SQL in Sixty Seconds #051 &#124; SQL Server Journey with SQL Authority</title>
		<link>http://blog.sqlauthority.com/2012/08/23/sql-server-reseting-identity-values-for-all-tables/#comment-471063</link>
		<dc:creator><![CDATA[SQL SERVER &#8211; RESEED Identity Column in Database Table &#8211; Rest Table Identity Value &#8211; SQL in Sixty Seconds #051 &#124; SQL Server Journey with SQL Authority]]></dc:creator>
		<pubDate>Wed, 08 May 2013 01:31:20 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=20412#comment-471063</guid>
		<description><![CDATA[[...] Reseting Identity Values for All Tables [...]]]></description>
		<content:encoded><![CDATA[<p>[...] Reseting Identity Values for All Tables [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: madhivanan</title>
		<link>http://blog.sqlauthority.com/2012/08/23/sql-server-reseting-identity-values-for-all-tables/#comment-422136</link>
		<dc:creator><![CDATA[madhivanan]]></dc:creator>
		<pubDate>Fri, 15 Feb 2013 13:37:19 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=20412#comment-422136</guid>
		<description><![CDATA[Why does a gap in the identity column matter? You can use DBCC Checkident command to reset]]></description>
		<content:encoded><![CDATA[<p>Why does a gap in the identity column matter? You can use DBCC Checkident command to reset</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: unyuu</title>
		<link>http://blog.sqlauthority.com/2012/08/23/sql-server-reseting-identity-values-for-all-tables/#comment-407498</link>
		<dc:creator><![CDATA[unyuu]]></dc:creator>
		<pubDate>Mon, 14 Jan 2013 09:15:24 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=20412#comment-407498</guid>
		<description><![CDATA[Hi,  I want to ask..
how do I use an identity increment again after i delete it without deleting the other rows? 
For example, the last identity is 151, and i added 152, but i delete the 152,...
so since the last row still 151, how to make it become 152 again not 153, when i add a new row again.
???]]></description>
		<content:encoded><![CDATA[<p>Hi,  I want to ask..<br />
how do I use an identity increment again after i delete it without deleting the other rows?<br />
For example, the last identity is 151, and i added 152, but i delete the 152,&#8230;<br />
so since the last row still 151, how to make it become 152 again not 153, when i add a new row again.<br />
???</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sarada</title>
		<link>http://blog.sqlauthority.com/2012/08/23/sql-server-reseting-identity-values-for-all-tables/#comment-367425</link>
		<dc:creator><![CDATA[Sarada]]></dc:creator>
		<pubDate>Thu, 01 Nov 2012 08:11:20 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=20412#comment-367425</guid>
		<description><![CDATA[Hi i have used following query to delete the data from all tables in my db.

CREATE PROCEDURE [dbo].[usp_DeleteAllData]
AS
EXEC sp_MSForEachTable &#039;ALTER TABLE ? NOCHECK CONSTRAINT ALL&#039;
EXEC sp_MSForEachTable &#039;ALTER TABLE ? DISABLE TRIGGER ALL&#039;
EXEC sp_MSForEachTable &#039;DELETE FROM ?&#039;
EXEC sp_MSForEachTable &#039;ALTER TABLE ? CHECK CONSTRAINT ALL&#039;
EXEC sp_MSForEachTable &#039;ALTER TABLE ? ENABLE TRIGGER ALL&#039;
EXEC sp_MSFOREACHTABLE &#039;SELECT * FROM ?&#039;
GO

on execution of the above sp am able to delete the data. Can use truncate instead of &#039;Delete&#039; so that it will automatically reseed the identities or shall i include the query u provided at the end of the sp?]]></description>
		<content:encoded><![CDATA[<p>Hi i have used following query to delete the data from all tables in my db.</p>
<p>CREATE PROCEDURE [dbo].[usp_DeleteAllData]<br />
AS<br />
EXEC sp_MSForEachTable &#8216;ALTER TABLE ? NOCHECK CONSTRAINT ALL&#8217;<br />
EXEC sp_MSForEachTable &#8216;ALTER TABLE ? DISABLE TRIGGER ALL&#8217;<br />
EXEC sp_MSForEachTable &#8216;DELETE FROM ?&#8217;<br />
EXEC sp_MSForEachTable &#8216;ALTER TABLE ? CHECK CONSTRAINT ALL&#8217;<br />
EXEC sp_MSForEachTable &#8216;ALTER TABLE ? ENABLE TRIGGER ALL&#8217;<br />
EXEC sp_MSFOREACHTABLE &#8216;SELECT * FROM ?&#8217;<br />
GO</p>
<p>on execution of the above sp am able to delete the data. Can use truncate instead of &#8216;Delete&#8217; so that it will automatically reseed the identities or shall i include the query u provided at the end of the sp?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Vikas kattaria</title>
		<link>http://blog.sqlauthority.com/2012/08/23/sql-server-reseting-identity-values-for-all-tables/#comment-340467</link>
		<dc:creator><![CDATA[Vikas kattaria]]></dc:creator>
		<pubDate>Mon, 03 Sep 2012 09:23:03 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=20412#comment-340467</guid>
		<description><![CDATA[what we have to do when any one uses the identity column as primary key, and  referenced to other table(foreign key) then how can we re-generate the Identity column, without changing the relationship of columns as well as data.]]></description>
		<content:encoded><![CDATA[<p>what we have to do when any one uses the identity column as primary key, and  referenced to other table(foreign key) then how can we re-generate the Identity column, without changing the relationship of columns as well as data.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SQL SERVER &#8211; Answer &#8211; Value of Identity Column after TRUNCATE command &#171; SQL Server Journey with SQL Authority</title>
		<link>http://blog.sqlauthority.com/2012/08/23/sql-server-reseting-identity-values-for-all-tables/#comment-337766</link>
		<dc:creator><![CDATA[SQL SERVER &#8211; Answer &#8211; Value of Identity Column after TRUNCATE command &#171; SQL Server Journey with SQL Authority]]></dc:creator>
		<pubDate>Mon, 27 Aug 2012 01:31:17 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=20412#comment-337766</guid>
		<description><![CDATA[[...] where I almost got a headache. I suggest all of you to read it before continuing this blog post SQL SERVER – Reseting Identity Values for All Tables. I believed that he faced this situation because he did not understand the difference between SQL [...]]]></description>
		<content:encoded><![CDATA[<p>[...] where I almost got a headache. I suggest all of you to read it before continuing this blog post SQL SERVER – Reseting Identity Values for All Tables. I believed that he faced this situation because he did not understand the difference between SQL [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ronald Kraijesteijn★ (@bonkiekonkie)</title>
		<link>http://blog.sqlauthority.com/2012/08/23/sql-server-reseting-identity-values-for-all-tables/#comment-336729</link>
		<dc:creator><![CDATA[Ronald Kraijesteijn★ (@bonkiekonkie)]]></dc:creator>
		<pubDate>Fri, 24 Aug 2012 09:26:28 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=20412#comment-336729</guid>
		<description><![CDATA[Hi Perry,

You can also create DELETE statements and run that script a couple of times till all tables are empty:

SELECT &#039;
GO
DELETE FROM ps.&#039; + TabelNaam 

FROM
      -- LT: Linked Tables
      (SELECT O.name AS TabelNaam
            , S.name AS SchemaName
      FROM sysobjects AS O
      LEFT OUTER JOIN sys.schemas AS S ON O.uid = S.schema_id
      WHERE O.type = &#039;u&#039; AND O.uid=5
            --AND CHARINDEX(&#039;_&#039;,O.name)=0
      --ORDER BY O.[name]
      ) AS LT
WHERE SchemaName = &#039;ps&#039;
ORDER BY TabelNaam


After that, you can reset the ident fields with the script above.

Note: set the output to Text]]></description>
		<content:encoded><![CDATA[<p>Hi Perry,</p>
<p>You can also create DELETE statements and run that script a couple of times till all tables are empty:</p>
<p>SELECT &#8216;<br />
GO<br />
DELETE FROM ps.&#8217; + TabelNaam </p>
<p>FROM<br />
      &#8212; LT: Linked Tables<br />
      (SELECT O.name AS TabelNaam<br />
            , S.name AS SchemaName<br />
      FROM sysobjects AS O<br />
      LEFT OUTER JOIN sys.schemas AS S ON O.uid = S.schema_id<br />
      WHERE O.type = &#8216;u&#8217; AND O.uid=5<br />
            &#8211;AND CHARINDEX(&#8216;_&#8217;,O.name)=0<br />
      &#8211;ORDER BY O.[name]<br />
      ) AS LT<br />
WHERE SchemaName = &#8216;ps&#8217;<br />
ORDER BY TabelNaam</p>
<p>After that, you can reset the ident fields with the script above.</p>
<p>Note: set the output to Text</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Allan Svelmøe Hansen (@Svelmoe)</title>
		<link>http://blog.sqlauthority.com/2012/08/23/sql-server-reseting-identity-values-for-all-tables/#comment-336655</link>
		<dc:creator><![CDATA[Allan Svelmøe Hansen (@Svelmoe)]]></dc:creator>
		<pubDate>Fri, 24 Aug 2012 05:32:14 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=20412#comment-336655</guid>
		<description><![CDATA[Or drop the constraints and recreate them afterwards.
That can also be scripted.]]></description>
		<content:encoded><![CDATA[<p>Or drop the constraints and recreate them afterwards.<br />
That can also be scripted.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SQL SERVER &#8211; DELETE, TRUNCATE and RESEED Identity &#171; SQL Server Journey with SQL Authority</title>
		<link>http://blog.sqlauthority.com/2012/08/23/sql-server-reseting-identity-values-for-all-tables/#comment-336576</link>
		<dc:creator><![CDATA[SQL SERVER &#8211; DELETE, TRUNCATE and RESEED Identity &#171; SQL Server Journey with SQL Authority]]></dc:creator>
		<pubDate>Fri, 24 Aug 2012 01:30:59 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=20412#comment-336576</guid>
		<description><![CDATA[[...] Comments        &#171; SQL SERVER &#8211; Reseting Identity Values for All&#160;Tables [...]]]></description>
		<content:encoded><![CDATA[<p>[...] Comments        &laquo; SQL SERVER &#8211; Reseting Identity Values for All&nbsp;Tables [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Perry Whittle</title>
		<link>http://blog.sqlauthority.com/2012/08/23/sql-server-reseting-identity-values-for-all-tables/#comment-336432</link>
		<dc:creator><![CDATA[Perry Whittle]]></dc:creator>
		<pubDate>Thu, 23 Aug 2012 17:48:25 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=20412#comment-336432</guid>
		<description><![CDATA[Hi

Truncate will not be allowed if the user has any referential integrity in place on the tables to be truncated. In this case you would need to disable any integrity before truncating and even loading the tables

Regards Perry]]></description>
		<content:encoded><![CDATA[<p>Hi</p>
<p>Truncate will not be allowed if the user has any referential integrity in place on the tables to be truncated. In this case you would need to disable any integrity before truncating and even loading the tables</p>
<p>Regards Perry</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ayman El-Ghazali</title>
		<link>http://blog.sqlauthority.com/2012/08/23/sql-server-reseting-identity-values-for-all-tables/#comment-336392</link>
		<dc:creator><![CDATA[Ayman El-Ghazali]]></dc:creator>
		<pubDate>Thu, 23 Aug 2012 16:22:10 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=20412#comment-336392</guid>
		<description><![CDATA[Patience is definitely a virtue and the spam filter didn&#039;t seem to help at all!]]></description>
		<content:encoded><![CDATA[<p>Patience is definitely a virtue and the spam filter didn&#8217;t seem to help at all!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Josien</title>
		<link>http://blog.sqlauthority.com/2012/08/23/sql-server-reseting-identity-values-for-all-tables/#comment-336361</link>
		<dc:creator><![CDATA[Josien]]></dc:creator>
		<pubDate>Thu, 23 Aug 2012 15:00:56 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=20412#comment-336361</guid>
		<description><![CDATA[I had to laugh aloud after reading this conversation... Thanks for sharing Pinal!]]></description>
		<content:encoded><![CDATA[<p>I had to laugh aloud after reading this conversation&#8230; Thanks for sharing Pinal!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nishad</title>
		<link>http://blog.sqlauthority.com/2012/08/23/sql-server-reseting-identity-values-for-all-tables/#comment-336304</link>
		<dc:creator><![CDATA[Nishad]]></dc:creator>
		<pubDate>Thu, 23 Aug 2012 12:55:18 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=20412#comment-336304</guid>
		<description><![CDATA[Hi,
Thanks for script! Sometimes problem with TRUNCATE is; when tables are related (or referenced), TRUNCATE fails. In such case DELETE is only option.]]></description>
		<content:encoded><![CDATA[<p>Hi,<br />
Thanks for script! Sometimes problem with TRUNCATE is; when tables are related (or referenced), TRUNCATE fails. In such case DELETE is only option.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ronald Kraijesteijn★ (@bonkiekonkie)</title>
		<link>http://blog.sqlauthority.com/2012/08/23/sql-server-reseting-identity-values-for-all-tables/#comment-336289</link>
		<dc:creator><![CDATA[Ronald Kraijesteijn★ (@bonkiekonkie)]]></dc:creator>
		<pubDate>Thu, 23 Aug 2012 12:43:52 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=20412#comment-336289</guid>
		<description><![CDATA[This is also a nice script to generate SQL statements. Set output of the SQL to &quot;Text&quot;

SELECT &#039;
GO
DBCC CHECKIDENT(&#039;&#039;ps.&#039; + TabelNaam  + &#039;&#039;&#039;,RESEED,0)&#039;

FROM
      -- LT: Linked Tables
      (SELECT O.name AS TabelNaam
            , S.name AS SchemaName
      FROM sysobjects AS O
      LEFT OUTER JOIN sys.schemas AS S ON O.uid = S.schema_id
      WHERE O.type = &#039;u&#039; AND O.uid=5
            AND CHARINDEX(&#039;_&#039;,O.name)=0
      --ORDER BY O.[name]
      ) AS LT
WHERE SchemaName = &#039;dbo&#039;
ORDER BY TabelNaam]]></description>
		<content:encoded><![CDATA[<p>This is also a nice script to generate SQL statements. Set output of the SQL to &#8220;Text&#8221;</p>
<p>SELECT &#8216;<br />
GO<br />
DBCC CHECKIDENT(&#8221;ps.&#8217; + TabelNaam  + &#8221;&#8217;,RESEED,0)&#8217;</p>
<p>FROM<br />
      &#8212; LT: Linked Tables<br />
      (SELECT O.name AS TabelNaam<br />
            , S.name AS SchemaName<br />
      FROM sysobjects AS O<br />
      LEFT OUTER JOIN sys.schemas AS S ON O.uid = S.schema_id<br />
      WHERE O.type = &#8216;u&#8217; AND O.uid=5<br />
            AND CHARINDEX(&#8216;_&#8217;,O.name)=0<br />
      &#8211;ORDER BY O.[name]<br />
      ) AS LT<br />
WHERE SchemaName = &#8216;dbo&#8217;<br />
ORDER BY TabelNaam</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: madhivanan</title>
		<link>http://blog.sqlauthority.com/2012/08/23/sql-server-reseting-identity-values-for-all-tables/#comment-336058</link>
		<dc:creator><![CDATA[madhivanan]]></dc:creator>
		<pubDate>Thu, 23 Aug 2012 06:19:27 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=20412#comment-336058</guid>
		<description><![CDATA[Yes but note that it will be applied for all the tables unless you specified a specific table name]]></description>
		<content:encoded><![CDATA[<p>Yes but note that it will be applied for all the tables unless you specified a specific table name</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: madhivanan</title>
		<link>http://blog.sqlauthority.com/2012/08/23/sql-server-reseting-identity-values-for-all-tables/#comment-336056</link>
		<dc:creator><![CDATA[madhivanan]]></dc:creator>
		<pubDate>Thu, 23 Aug 2012 06:09:46 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=20412#comment-336056</guid>
		<description><![CDATA[Here is an alternate method http://beyondrelational.com/modules/2/blogs/70/Posts/17532/resetting-identity-values-for-all-tables.aspx]]></description>
		<content:encoded><![CDATA[<p>Here is an alternate method <a href="http://beyondrelational.com/modules/2/blogs/70/Posts/17532/resetting-identity-values-for-all-tables.aspx" rel="nofollow">http://beyondrelational.com/modules/2/blogs/70/Posts/17532/resetting-identity-values-for-all-tables.aspx</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: kaushal dhora</title>
		<link>http://blog.sqlauthority.com/2012/08/23/sql-server-reseting-identity-values-for-all-tables/#comment-336032</link>
		<dc:creator><![CDATA[kaushal dhora]]></dc:creator>
		<pubDate>Thu, 23 Aug 2012 05:19:32 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=20412#comment-336032</guid>
		<description><![CDATA[Hammering....:)]]></description>
		<content:encoded><![CDATA[<p>Hammering&#8230;.:)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Manoj Sahoo</title>
		<link>http://blog.sqlauthority.com/2012/08/23/sql-server-reseting-identity-values-for-all-tables/#comment-335998</link>
		<dc:creator><![CDATA[Manoj Sahoo]]></dc:creator>
		<pubDate>Thu, 23 Aug 2012 04:42:24 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=20412#comment-335998</guid>
		<description><![CDATA[I enjoyed the Conversation Pinal sir....]]></description>
		<content:encoded><![CDATA[<p>I enjoyed the Conversation Pinal sir&#8230;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sreelekha Vikram</title>
		<link>http://blog.sqlauthority.com/2012/08/23/sql-server-reseting-identity-values-for-all-tables/#comment-335960</link>
		<dc:creator><![CDATA[Sreelekha Vikram]]></dc:creator>
		<pubDate>Thu, 23 Aug 2012 03:33:16 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=20412#comment-335960</guid>
		<description><![CDATA[Hi Pinal,

Can we pass any type of SQL statement(i.e. DDL or DML) to this SP?]]></description>
		<content:encoded><![CDATA[<p>Hi Pinal,</p>
<p>Can we pass any type of SQL statement(i.e. DDL or DML) to this SP?</p>
]]></content:encoded>
	</item>
</channel>
</rss>
