<?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/"
		>
<channel>
	<title>Comments on: Identity column starts from zero instead of one</title>
	<atom:link href="http://www.scriptstar.co.uk/identity-column-starts-from-zero-instead-of-one/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.scriptstar.co.uk/identity-column-starts-from-zero-instead-of-one/</link>
	<description></description>
	<lastBuildDate>Sun, 20 Mar 2011 20:25:37 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.2</generator>
	<item>
		<title>By: SharePoint Sidekick</title>
		<link>http://www.scriptstar.co.uk/identity-column-starts-from-zero-instead-of-one/comment-page-1/#comment-200</link>
		<dc:creator>SharePoint Sidekick</dc:creator>
		<pubDate>Sun, 20 Mar 2011 20:25:37 +0000</pubDate>
		<guid isPermaLink="false">http://www.scriptstar.co.uk/?p=17#comment-200</guid>
		<description>&lt;strong&gt;Identity column starts from zero instead of one...&lt;/strong&gt;

Thank you for submitting this cool story - Trackback from SharePoint Sidekick...</description>
		<content:encoded><![CDATA[<p><strong>Identity column starts from zero instead of one&#8230;</strong></p>
<p>Thank you for submitting this cool story &#8211; Trackback from SharePoint Sidekick&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Narendra</title>
		<link>http://www.scriptstar.co.uk/identity-column-starts-from-zero-instead-of-one/comment-page-1/#comment-6</link>
		<dc:creator>Narendra</dc:creator>
		<pubDate>Thu, 30 Jul 2009 22:32:35 +0000</pubDate>
		<guid isPermaLink="false">http://www.scriptstar.co.uk/?p=17#comment-6</guid>
		<description>Hi VK,

First of all, I am not sure why SQL server is starting some tables with identity column 0 and some tables with 1 after using reseed.

Actually I wrote a procedure and it will start by checking whether the table in the database is having any identity column set or not.

If the table has an identity column then it will try to truncate the table data and set the reseed to 1. If you don&#039;t use truncate then table identity column is starting from 0.

But you can&#039;t use truncate for all the tables, some tables may throw an exception (you can use delete statement for these tables) so I wrapped the above statement with TRY block.

If it throws an error then I can catch that and use delete statement and reseed to 0.

Hope this explanation is helpful.

May not be logical but works fine for me. Have you tried and tested my solution?

Cheers,
Scriptstar</description>
		<content:encoded><![CDATA[<p>Hi VK,</p>
<p>First of all, I am not sure why SQL server is starting some tables with identity column 0 and some tables with 1 after using reseed.</p>
<p>Actually I wrote a procedure and it will start by checking whether the table in the database is having any identity column set or not.</p>
<p>If the table has an identity column then it will try to truncate the table data and set the reseed to 1. If you don&#8217;t use truncate then table identity column is starting from 0.</p>
<p>But you can&#8217;t use truncate for all the tables, some tables may throw an exception (you can use delete statement for these tables) so I wrapped the above statement with TRY block.</p>
<p>If it throws an error then I can catch that and use delete statement and reseed to 0.</p>
<p>Hope this explanation is helpful.</p>
<p>May not be logical but works fine for me. Have you tried and tested my solution?</p>
<p>Cheers,<br />
Scriptstar</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Vladimir Kelman</title>
		<link>http://www.scriptstar.co.uk/identity-column-starts-from-zero-instead-of-one/comment-page-1/#comment-5</link>
		<dc:creator>Vladimir Kelman</dc:creator>
		<pubDate>Wed, 29 Jul 2009 18:28:20 +0000</pubDate>
		<guid isPermaLink="false">http://www.scriptstar.co.uk/?p=17#comment-5</guid>
		<description>FYI: &lt;a target=&quot;_blank&quot; href=&quot;http://www.sqlservercentral.com/Forums/Topic761779-1291-1.aspx&quot; rel=&quot;nofollow&quot;&gt;http://www.sqlservercentral.com/Forums/Topic761779-1291-1.aspx&lt;/a&gt;</description>
		<content:encoded><![CDATA[<p>FYI: <a target="_blank" href="http://www.sqlservercentral.com/Forums/Topic761779-1291-1.aspx" rel="nofollow">http://www.sqlservercentral.com/Forums/Topic761779-1291-1.aspx</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Vladimir Kelman</title>
		<link>http://www.scriptstar.co.uk/identity-column-starts-from-zero-instead-of-one/comment-page-1/#comment-4</link>
		<dc:creator>Vladimir Kelman</dc:creator>
		<pubDate>Wed, 29 Jul 2009 16:42:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.scriptstar.co.uk/?p=17#comment-4</guid>
		<description>Thank you, Narendra!

Could you explain in a few words how it works?</description>
		<content:encoded><![CDATA[<p>Thank you, Narendra!</p>
<p>Could you explain in a few words how it works?</p>
]]></content:encoded>
	</item>
</channel>
</rss>

