<?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; DELETE, TRUNCATE and RESEED Identity</title>
	<atom:link href="http://blog.sqlauthority.com/2012/08/24/sql-server-delete-truncate-and-reseed-identity/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.sqlauthority.com/2012/08/24/sql-server-delete-truncate-and-reseed-identity/</link>
	<description>Personal Notes of Pinal Dave</description>
	<lastBuildDate>Fri, 17 May 2013 15:26:57 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: Emily</title>
		<link>http://blog.sqlauthority.com/2012/08/24/sql-server-delete-truncate-and-reseed-identity/#comment-475938</link>
		<dc:creator><![CDATA[Emily]]></dc:creator>
		<pubDate>Wed, 15 May 2013 19:00:41 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=20421#comment-475938</guid>
		<description><![CDATA[Thank you! Very clear and useful, and I appreciate the time you take to share your knowledge!]]></description>
		<content:encoded><![CDATA[<p>Thank you! Very clear and useful, and I appreciate the time you take to share your knowledge!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sunita</title>
		<link>http://blog.sqlauthority.com/2012/08/24/sql-server-delete-truncate-and-reseed-identity/#comment-471886</link>
		<dc:creator><![CDATA[sunita]]></dc:creator>
		<pubDate>Thu, 09 May 2013 09:17:49 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=20421#comment-471886</guid>
		<description><![CDATA[I got different results ... after truncate it return next identity as 11 and after Delete it give new identity as 2 ......]]></description>
		<content:encoded><![CDATA[<p>I got different results &#8230; after truncate it return next identity as 11 and after Delete it give new identity as 2 &#8230;&#8230;</p>
]]></content:encoded>
	</item>
	<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/24/sql-server-delete-truncate-and-reseed-identity/#comment-471062</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:17 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=20421#comment-471062</guid>
		<description><![CDATA[[...] DELETE, TRUNCATE and RESEED Identity [...]]]></description>
		<content:encoded><![CDATA[<p>[...] DELETE, TRUNCATE and RESEED Identity [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: THILLAI</title>
		<link>http://blog.sqlauthority.com/2012/08/24/sql-server-delete-truncate-and-reseed-identity/#comment-440913</link>
		<dc:creator><![CDATA[THILLAI]]></dc:creator>
		<pubDate>Wed, 20 Mar 2013 13:03:12 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=20421#comment-440913</guid>
		<description><![CDATA[great sir]]></description>
		<content:encoded><![CDATA[<p>great sir</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nimesh</title>
		<link>http://blog.sqlauthority.com/2012/08/24/sql-server-delete-truncate-and-reseed-identity/#comment-437638</link>
		<dc:creator><![CDATA[Nimesh]]></dc:creator>
		<pubDate>Fri, 15 Mar 2013 09:46:27 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=20421#comment-437638</guid>
		<description><![CDATA[how can we rollback &quot;DELETE&quot; command without using transaction?
Please help .]]></description>
		<content:encoded><![CDATA[<p>how can we rollback &#8220;DELETE&#8221; command without using transaction?<br />
Please help .</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ruther Roque</title>
		<link>http://blog.sqlauthority.com/2012/08/24/sql-server-delete-truncate-and-reseed-identity/#comment-420549</link>
		<dc:creator><![CDATA[Ruther Roque]]></dc:creator>
		<pubDate>Mon, 11 Feb 2013 09:26:33 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=20421#comment-420549</guid>
		<description><![CDATA[Hi Deepak,

Try to check first the constraints of the columns in your table, then, move forward. or you might want to DROP and CREATE a new table to test..

Regards,
Ruther Roque]]></description>
		<content:encoded><![CDATA[<p>Hi Deepak,</p>
<p>Try to check first the constraints of the columns in your table, then, move forward. or you might want to DROP and CREATE a new table to test..</p>
<p>Regards,<br />
Ruther Roque</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Deepak</title>
		<link>http://blog.sqlauthority.com/2012/08/24/sql-server-delete-truncate-and-reseed-identity/#comment-408835</link>
		<dc:creator><![CDATA[Deepak]]></dc:creator>
		<pubDate>Thu, 17 Jan 2013 07:11:39 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=20421#comment-408835</guid>
		<description><![CDATA[i am inserting records using select statement but insertion fails how i can find out which column  cause failure in sql]]></description>
		<content:encoded><![CDATA[<p>i am inserting records using select statement but insertion fails how i can find out which column  cause failure in sql</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jeevanudanjeevi</title>
		<link>http://blog.sqlauthority.com/2012/08/24/sql-server-delete-truncate-and-reseed-identity/#comment-395340</link>
		<dc:creator><![CDATA[jeevanudanjeevi]]></dc:creator>
		<pubDate>Tue, 18 Dec 2012 07:52:59 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=20421#comment-395340</guid>
		<description><![CDATA[Its great explanation

Answer is 11

CREATE TABLE [dbo].[TestTable](
[ID] [int] IDENTITY(11,1) NOT NULL,
[var] [nchar](10) NULL
) ON [PRIMARY]
GO

INSERT INTO [TestTable]
VALUES (&#039;val&#039;)

SELECT *
FROM [TestTable]
-----------------------------------------------------------------------------------------
DBCC CHECKIDENT (&#039;TestTable&#039;, RESEED, 1)


INSERT INTO [TestTable]
VALUES (&#039;val&#039;)

SELECT *
FROM [TestTable]
-----------------------------------------------------------------------------------------

TRUNCATE TABLE [TestTable]


INSERT INTO [TestTable]
VALUES (&#039;val&#039;)

SELECT *
FROM [TestTable]

-----------------------------------------------------------------------------------------]]></description>
		<content:encoded><![CDATA[<p>Its great explanation</p>
<p>Answer is 11</p>
<p>CREATE TABLE [dbo].[TestTable](<br />
[ID] [int] IDENTITY(11,1) NOT NULL,<br />
[var] [nchar](10) NULL<br />
) ON [PRIMARY]<br />
GO</p>
<p>INSERT INTO [TestTable]<br />
VALUES (&#8216;val&#8217;)</p>
<p>SELECT *<br />
FROM [TestTable]<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
DBCC CHECKIDENT (&#8216;TestTable&#8217;, RESEED, 1)</p>
<p>INSERT INTO [TestTable]<br />
VALUES (&#8216;val&#8217;)</p>
<p>SELECT *<br />
FROM [TestTable]<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>TRUNCATE TABLE [TestTable]</p>
<p>INSERT INTO [TestTable]<br />
VALUES (&#8216;val&#8217;)</p>
<p>SELECT *<br />
FROM [TestTable]</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Raj Bhardwaj</title>
		<link>http://blog.sqlauthority.com/2012/08/24/sql-server-delete-truncate-and-reseed-identity/#comment-369473</link>
		<dc:creator><![CDATA[Raj Bhardwaj]]></dc:creator>
		<pubDate>Mon, 05 Nov 2012 06:49:59 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=20421#comment-369473</guid>
		<description><![CDATA[Hi Pinal, its really very useful post. but I have a doubt that, suppose I have 100 record in my table and I delete any specific record, then how can I reuse identity value of deleted row when If I insert a new row to the table.  please explain.......]]></description>
		<content:encoded><![CDATA[<p>Hi Pinal, its really very useful post. but I have a doubt that, suppose I have 100 record in my table and I delete any specific record, then how can I reuse identity value of deleted row when If I insert a new row to the table.  please explain&#8230;&#8230;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Martyn Jones</title>
		<link>http://blog.sqlauthority.com/2012/08/24/sql-server-delete-truncate-and-reseed-identity/#comment-360781</link>
		<dc:creator><![CDATA[Martyn Jones]]></dc:creator>
		<pubDate>Tue, 16 Oct 2012 14:59:23 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=20421#comment-360781</guid>
		<description><![CDATA[The answer is 11.

When a reseed is applied before a truncate, the truncate will reset the counter for the column to the (original) seed of the column, not the reseed of the colum as this no longer exists.

In answer to Debashis, DELETE does not do the same as truncate, it maintains the current seed. Truncate is more efficent than delete but in order to get back to the last seed (as with DELETE) a reseed would be needed after the TRUNCATE.

http://msdn.microsoft.com/en-us/library/aa258817(v=sql.80).aspx

&quot;The current identity value is set to the new_reseed_value. If no rows have been inserted to the table since it was created, the first row inserted after executing DBCC CHECKIDENT will use new_reseed_value as the identity. Otherwise, the next row inserted will use new_reseed_value + 1. If the value of new_reseed_value is less than the maximum value in the identity column, error message 2627 will be generated on subsequent references to the table.&quot;

http://msdn.microsoft.com/en-us/library/aa260621(v=sql.80).aspx

&quot;TRUNCATE TABLE removes all rows from a table, but the table structure and its columns, constraints, indexes and so on remain. The counter used by an identity for new rows is reset to the seed for the column. If you want to retain the identity counter, use DELETE instead.&quot;

Fun:

	USE [TempDB]
	GO
	-- Create Table
	CREATE TABLE [dbo].[TestTable](	[ID] [int] IDENTITY(11,1) NOT NULL,
									[var] [nchar](10) NULL
								   ) ON [PRIMARY]
	GO
	
	-- Build sample data
	INSERT INTO [TestTable]
	VALUES (&#039;val&#039;)
	GO
	
	-- Reseed
	DBCC CHECKIDENT (&#039;TestTable&#039;, RESEED, 600)
	GO

--play here, try with and without ------
	-- Truncate table
	TRUNCATE TABLE [TestTable]
	GO
-----	
	-- Put sample data in again
	INSERT INTO [TestTable]
	VALUES (&#039;val&#039;)
	GO
	
	-- Select Data
	SELECT *
	FROM [TestTable]
	GO

	-- Clean up
	DROP TABLE [TestTable]
	GO]]></description>
		<content:encoded><![CDATA[<p>The answer is 11.</p>
<p>When a reseed is applied before a truncate, the truncate will reset the counter for the column to the (original) seed of the column, not the reseed of the colum as this no longer exists.</p>
<p>In answer to Debashis, DELETE does not do the same as truncate, it maintains the current seed. Truncate is more efficent than delete but in order to get back to the last seed (as with DELETE) a reseed would be needed after the TRUNCATE.</p>
<p><a href="http://msdn.microsoft.com/en-us/library/aa258817(v=sql.80)" rel="nofollow">http://msdn.microsoft.com/en-us/library/aa258817(v=sql.80)</a>.aspx</p>
<p>&#8220;The current identity value is set to the new_reseed_value. If no rows have been inserted to the table since it was created, the first row inserted after executing DBCC CHECKIDENT will use new_reseed_value as the identity. Otherwise, the next row inserted will use new_reseed_value + 1. If the value of new_reseed_value is less than the maximum value in the identity column, error message 2627 will be generated on subsequent references to the table.&#8221;</p>
<p><a href="http://msdn.microsoft.com/en-us/library/aa260621(v=sql.80)" rel="nofollow">http://msdn.microsoft.com/en-us/library/aa260621(v=sql.80)</a>.aspx</p>
<p>&#8220;TRUNCATE TABLE removes all rows from a table, but the table structure and its columns, constraints, indexes and so on remain. The counter used by an identity for new rows is reset to the seed for the column. If you want to retain the identity counter, use DELETE instead.&#8221;</p>
<p>Fun:</p>
<p>	USE [TempDB]<br />
	GO<br />
	&#8211; Create Table<br />
	CREATE TABLE [dbo].[TestTable](	[ID] [int] IDENTITY(11,1) NOT NULL,<br />
									[var] [nchar](10) NULL<br />
								   ) ON [PRIMARY]<br />
	GO</p>
<p>	&#8211; Build sample data<br />
	INSERT INTO [TestTable]<br />
	VALUES (&#8216;val&#8217;)<br />
	GO</p>
<p>	&#8211; Reseed<br />
	DBCC CHECKIDENT (&#8216;TestTable&#8217;, RESEED, 600)<br />
	GO</p>
<p>&#8211;play here, try with and without &#8212;&#8212;<br />
	&#8211; Truncate table<br />
	TRUNCATE TABLE [TestTable]<br />
	GO<br />
&#8212;&#8211;<br />
	&#8211; Put sample data in again<br />
	INSERT INTO [TestTable]<br />
	VALUES (&#8216;val&#8217;)<br />
	GO</p>
<p>	&#8211; Select Data<br />
	SELECT *<br />
	FROM [TestTable]<br />
	GO</p>
<p>	&#8211; Clean up<br />
	DROP TABLE [TestTable]<br />
	GO</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jija</title>
		<link>http://blog.sqlauthority.com/2012/08/24/sql-server-delete-truncate-and-reseed-identity/#comment-346648</link>
		<dc:creator><![CDATA[Jija]]></dc:creator>
		<pubDate>Fri, 14 Sep 2012 19:14:21 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=20421#comment-346648</guid>
		<description><![CDATA[Hi, Debashis. I did same and getting Seed 11.
I am using SQL SERVER 2008 and used below queries to delete and commit trans:
Begin Tran
delete TestTable
Commit]]></description>
		<content:encoded><![CDATA[<p>Hi, Debashis. I did same and getting Seed 11.<br />
I am using SQL SERVER 2008 and used below queries to delete and commit trans:<br />
Begin Tran<br />
delete TestTable<br />
Commit</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bhargav</title>
		<link>http://blog.sqlauthority.com/2012/08/24/sql-server-delete-truncate-and-reseed-identity/#comment-343692</link>
		<dc:creator><![CDATA[Bhargav]]></dc:creator>
		<pubDate>Thu, 13 Sep 2012 14:09:42 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=20421#comment-343692</guid>
		<description><![CDATA[Truncate statement always sets the seed value to its original value.. In this case its 11]]></description>
		<content:encoded><![CDATA[<p>Truncate statement always sets the seed value to its original value.. In this case its 11</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: shanmukha</title>
		<link>http://blog.sqlauthority.com/2012/08/24/sql-server-delete-truncate-and-reseed-identity/#comment-341630</link>
		<dc:creator><![CDATA[shanmukha]]></dc:creator>
		<pubDate>Fri, 07 Sep 2012 01:36:33 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=20421#comment-341630</guid>
		<description><![CDATA[its 11..............]]></description>
		<content:encoded><![CDATA[<p>its 11&#8230;&#8230;&#8230;&#8230;..</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: nitu</title>
		<link>http://blog.sqlauthority.com/2012/08/24/sql-server-delete-truncate-and-reseed-identity/#comment-340805</link>
		<dc:creator><![CDATA[nitu]]></dc:creator>
		<pubDate>Tue, 04 Sep 2012 11:49:35 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=20421#comment-340805</guid>
		<description><![CDATA[i have 3 tables with key relations

create table dbo.sale
 1,&#039;anday&#039;,61,1000
2,&#039;rachod&#039;,34,2000
5,&#039;chris&#039;,24,3000
 7,&#039;corms&#039;,41,4000
 8,&#039;ross&#039;,57,5000
 9,&#039;joe&#039;,38,6000


create table dbo.client
 4,&#039;pizza&#039;,&#039;holland&#039;,&#039;f&amp;b&#039;
 5,&#039;domino&#039;,&#039;chicago&#039;,&#039;f&amp;b&#039;
7,&#039;pizzacornar&#039;,&#039;newyork&#039;,&#039;f&amp;b&#039;
 9,&#039;papa johns&#039;,&#039;miching&#039;,&#039;f&amp;b&#039;


create table dbo.orders
 10,&#039;8/2/96&#039;,4,2,540
 20,&#039;1/30/99&#039;,4,8,1800
30,&#039;7/14/95&#039;,9,1,460
 40,&#039;1/29/98&#039;,7,2,2400
50,&#039;2/3/98&#039;,6,7,600
60,&#039;3/2/98&#039;,6,7,720
70,&#039;5/6/98&#039;,9,7,150
60,&#039;3/2/98&#039;,6,7,720

please answer  for this questions.

1. names of all saleperson who have an order with dominos
2. the names all saleperson who do not have any order with Dominos&amp; papa johns
3. the names of sales person that have 2 or more orders worth $150
4. write sql trigger to insert rows into a table called higher
achiever (names,age)
    when a sale person sales amount gooes abouve $500

5. write queries to delete any duplicate rows the orders table

6. names of the saleperson who have not made any sales or sales less
then $50 in each year

explain it]]></description>
		<content:encoded><![CDATA[<p>i have 3 tables with key relations</p>
<p>create table dbo.sale<br />
 1,&#8217;anday&#8217;,61,1000<br />
2,&#8217;rachod&#8217;,34,2000<br />
5,&#8217;chris&#8217;,24,3000<br />
 7,&#8217;corms&#8217;,41,4000<br />
 8,&#8217;ross&#8217;,57,5000<br />
 9,&#8217;joe&#8217;,38,6000</p>
<p>create table dbo.client<br />
 4,&#8217;pizza&#8217;,'holland&#8217;,'f&amp;b&#8217;<br />
 5,&#8217;domino&#8217;,'chicago&#8217;,'f&amp;b&#8217;<br />
7,&#8217;pizzacornar&#8217;,'newyork&#8217;,'f&amp;b&#8217;<br />
 9,&#8217;papa johns&#8217;,'miching&#8217;,'f&amp;b&#8217;</p>
<p>create table dbo.orders<br />
 10,&#8217;8/2/96&#8242;,4,2,540<br />
 20,&#8217;1/30/99&#8242;,4,8,1800<br />
30,&#8217;7/14/95&#8242;,9,1,460<br />
 40,&#8217;1/29/98&#8242;,7,2,2400<br />
50,&#8217;2/3/98&#8242;,6,7,600<br />
60,&#8217;3/2/98&#8242;,6,7,720<br />
70,&#8217;5/6/98&#8242;,9,7,150<br />
60,&#8217;3/2/98&#8242;,6,7,720</p>
<p>please answer  for this questions.</p>
<p>1. names of all saleperson who have an order with dominos<br />
2. the names all saleperson who do not have any order with Dominos&amp; papa johns<br />
3. the names of sales person that have 2 or more orders worth $150<br />
4. write sql trigger to insert rows into a table called higher<br />
achiever (names,age)<br />
    when a sale person sales amount gooes abouve $500</p>
<p>5. write queries to delete any duplicate rows the orders table</p>
<p>6. names of the saleperson who have not made any sales or sales less<br />
then $50 in each year</p>
<p>explain it</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Debashis</title>
		<link>http://blog.sqlauthority.com/2012/08/24/sql-server-delete-truncate-and-reseed-identity/#comment-338771</link>
		<dc:creator><![CDATA[Debashis]]></dc:creator>
		<pubDate>Wed, 29 Aug 2012 12:27:58 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=20421#comment-338771</guid>
		<description><![CDATA[I want to know one thing..The truncate statement will reset the table to its original “seed” value. this would be “11″ then.
If we are using delete to delete 5 records and after deleting the records, we are committing the same..then if we want to insert new data then the seed value will not start from 6..it will start from 11..Why is it so? As delete is followed by commit so it should act as truncate and delete the records and seed value permanently and we should able to insert data with deleted seed values..Can anybody put an idea on this?..I am quite new to database...]]></description>
		<content:encoded><![CDATA[<p>I want to know one thing..The truncate statement will reset the table to its original “seed” value. this would be “11″ then.<br />
If we are using delete to delete 5 records and after deleting the records, we are committing the same..then if we want to insert new data then the seed value will not start from 6..it will start from 11..Why is it so? As delete is followed by commit so it should act as truncate and delete the records and seed value permanently and we should able to insert data with deleted seed values..Can anybody put an idea on this?..I am quite new to database&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Karthik K</title>
		<link>http://blog.sqlauthority.com/2012/08/24/sql-server-delete-truncate-and-reseed-identity/#comment-338725</link>
		<dc:creator><![CDATA[Karthik K]]></dc:creator>
		<pubDate>Wed, 29 Aug 2012 10:40:55 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=20421#comment-338725</guid>
		<description><![CDATA[CREATE TABLE #RESEED(ID INT IDENTITY(11,1), NAME VARCHAR(20))

INSERT INTO #RESEED (NAME) VALUES (&#039;A&#039;)

SELECT * FROM #RESEED

TRUNCATE TABLE #RESEED

DBCC CHECKIDENT(&#039;#RESEED&#039;, RESEED,1)

INSERT INTO #RESEED (NAME) VALUES (&#039;A&#039;)

SELECT * FROM #RESEED

The Seed value should be : 1]]></description>
		<content:encoded><![CDATA[<p>CREATE TABLE #RESEED(ID INT IDENTITY(11,1), NAME VARCHAR(20))</p>
<p>INSERT INTO #RESEED (NAME) VALUES (&#8216;A&#8217;)</p>
<p>SELECT * FROM #RESEED</p>
<p>TRUNCATE TABLE #RESEED</p>
<p>DBCC CHECKIDENT(&#8216;#RESEED&#8217;, RESEED,1)</p>
<p>INSERT INTO #RESEED (NAME) VALUES (&#8216;A&#8217;)</p>
<p>SELECT * FROM #RESEED</p>
<p>The Seed value should be : 1</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Daniel K</title>
		<link>http://blog.sqlauthority.com/2012/08/24/sql-server-delete-truncate-and-reseed-identity/#comment-337873</link>
		<dc:creator><![CDATA[Daniel K]]></dc:creator>
		<pubDate>Mon, 27 Aug 2012 09:00:23 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=20421#comment-337873</guid>
		<description><![CDATA[The truncate statement will reset the table to its original &quot;seed&quot; value. this would be &quot;11&quot; then. 
Reseeding is not good for the table. It can (will) come to collisions on inserted values since there there is no check on table level and the insert will fail when you insert the value &quot;11&quot; again after reseeding with &quot;2&quot;.

Great Blog, keep up the good work!]]></description>
		<content:encoded><![CDATA[<p>The truncate statement will reset the table to its original &#8220;seed&#8221; value. this would be &#8220;11&#8243; then.<br />
Reseeding is not good for the table. It can (will) come to collisions on inserted values since there there is no check on table level and the insert will fail when you insert the value &#8220;11&#8243; again after reseeding with &#8220;2&#8243;.</p>
<p>Great Blog, keep up the good work!</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/24/sql-server-delete-truncate-and-reseed-identity/#comment-337767</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:20 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=20421#comment-337767</guid>
		<description><![CDATA[[...] I believed that he faced this situation because he did not understand the difference between SQL SERVER – DELETE, TRUNCATE and RESEED Identity. I wrote a follow up blog post explaining the difference between them. I asked a small question in [...]]]></description>
		<content:encoded><![CDATA[<p>[...] I believed that he faced this situation because he did not understand the difference between SQL SERVER – DELETE, TRUNCATE and RESEED Identity. I wrote a follow up blog post explaining the difference between them. I asked a small question in [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ashish Kadam</title>
		<link>http://blog.sqlauthority.com/2012/08/24/sql-server-delete-truncate-and-reseed-identity/#comment-337171</link>
		<dc:creator><![CDATA[Ashish Kadam]]></dc:creator>
		<pubDate>Sat, 25 Aug 2012 11:18:57 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=20421#comment-337171</guid>
		<description><![CDATA[seed value is 11
b&#039;cas when you can change seed value and insert any value in table,
it starts with new seed value but when we can use truncate command on table it takes original seed value.

thanks, it&#039;s very good blog]]></description>
		<content:encoded><![CDATA[<p>seed value is 11<br />
b&#8217;cas when you can change seed value and insert any value in table,<br />
it starts with new seed value but when we can use truncate command on table it takes original seed value.</p>
<p>thanks, it&#8217;s very good blog</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Vinay B Hiraskar</title>
		<link>http://blog.sqlauthority.com/2012/08/24/sql-server-delete-truncate-and-reseed-identity/#comment-337064</link>
		<dc:creator><![CDATA[Vinay B Hiraskar]]></dc:creator>
		<pubDate>Sat, 25 Aug 2012 05:47:32 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=20421#comment-337064</guid>
		<description><![CDATA[HI Pinal Sir, 
Answer is Original Seed Value.
Say...
if original seed value is 11 and I reseed the value to 1. If I follow up with truncate table, Then the seed value now is 11.

Thank for Knowledge Sharing  :)]]></description>
		<content:encoded><![CDATA[<p>HI Pinal Sir,<br />
Answer is Original Seed Value.<br />
Say&#8230;<br />
if original seed value is 11 and I reseed the value to 1. If I follow up with truncate table, Then the seed value now is 11.</p>
<p>Thank for Knowledge Sharing  :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Manju K</title>
		<link>http://blog.sqlauthority.com/2012/08/24/sql-server-delete-truncate-and-reseed-identity/#comment-337048</link>
		<dc:creator><![CDATA[Manju K]]></dc:creator>
		<pubDate>Sat, 25 Aug 2012 04:53:43 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=20421#comment-337048</guid>
		<description><![CDATA[when we used TRANCATE command it will deletes all record of the table and sets identity column&#039;s seed to original seed value whereas RESEED resets identity column&#039;s seed to new seed i.e 1+Random Number]]></description>
		<content:encoded><![CDATA[<p>when we used TRANCATE command it will deletes all record of the table and sets identity column&#8217;s seed to original seed value whereas RESEED resets identity column&#8217;s seed to new seed i.e 1+Random Number</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: DQ</title>
		<link>http://blog.sqlauthority.com/2012/08/24/sql-server-delete-truncate-and-reseed-identity/#comment-336896</link>
		<dc:creator><![CDATA[DQ]]></dc:creator>
		<pubDate>Fri, 24 Aug 2012 18:32:15 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=20421#comment-336896</guid>
		<description><![CDATA[Reseeding is very dangerous indeed. 
If you keep inserting new values, you&#039;ll end up with duplicate entries because SQL server will not check if the value already exists. And if you add a unique constraint (which would be logical for a identity column) the insert will fail. 
So &#039;Truncate Table&#039; is indeed the best solution to avoid collisions.]]></description>
		<content:encoded><![CDATA[<p>Reseeding is very dangerous indeed.<br />
If you keep inserting new values, you&#8217;ll end up with duplicate entries because SQL server will not check if the value already exists. And if you add a unique constraint (which would be logical for a identity column) the insert will fail.<br />
So &#8216;Truncate Table&#8217; is indeed the best solution to avoid collisions.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Girijesh</title>
		<link>http://blog.sqlauthority.com/2012/08/24/sql-server-delete-truncate-and-reseed-identity/#comment-336856</link>
		<dc:creator><![CDATA[Girijesh]]></dc:creator>
		<pubDate>Fri, 24 Aug 2012 15:33:44 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=20421#comment-336856</guid>
		<description><![CDATA[Hi Pinal,

Thanks a lot for this post.

Answer: After Truncate command DBCC RESEED will not work, so the reseed value would be 11 i.e. original value instead of 1.which has been reseed  by DBCC RESEED Command.]]></description>
		<content:encoded><![CDATA[<p>Hi Pinal,</p>
<p>Thanks a lot for this post.</p>
<p>Answer: After Truncate command DBCC RESEED will not work, so the reseed value would be 11 i.e. original value instead of 1.which has been reseed  by DBCC RESEED Command.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Partha Dutta Gupta</title>
		<link>http://blog.sqlauthority.com/2012/08/24/sql-server-delete-truncate-and-reseed-identity/#comment-336848</link>
		<dc:creator><![CDATA[Partha Dutta Gupta]]></dc:creator>
		<pubDate>Fri, 24 Aug 2012 15:08:53 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=20421#comment-336848</guid>
		<description><![CDATA[The new seed value will be 11]]></description>
		<content:encoded><![CDATA[<p>The new seed value will be 11</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Seemant Kumar</title>
		<link>http://blog.sqlauthority.com/2012/08/24/sql-server-delete-truncate-and-reseed-identity/#comment-336823</link>
		<dc:creator><![CDATA[Seemant Kumar]]></dc:creator>
		<pubDate>Fri, 24 Aug 2012 13:40:01 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=20421#comment-336823</guid>
		<description><![CDATA[Hi Pinal,

Thanks for this article really it good. It clears my some doubts.

Answer of your question is : If we call Truncate after Reseed command then the Identity will be changed to initial value means the Identity reset to 11.]]></description>
		<content:encoded><![CDATA[<p>Hi Pinal,</p>
<p>Thanks for this article really it good. It clears my some doubts.</p>
<p>Answer of your question is : If we call Truncate after Reseed command then the Identity will be changed to initial value means the Identity reset to 11.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
