﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / SQL Server 2008 / T-SQL (SS2K8)  / set identity insert on / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Mon, 20 May 2013 06:02:10 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: set identity insert on</title><link>http://www.sqlservercentral.com/Forums/Topic1408997-392-1.aspx</link><description>No, you should not have to; the db engine takes care of that itself.From Books Online:"If the value inserted is larger than the current identity value for the table, SQL Server automatically uses the new inserted value as the current identity value."So, SQL Server auto-adjusts the identity value up as you add higher-valued rows.</description><pubDate>Mon, 21 Jan 2013 14:24:37 GMT</pubDate><dc:creator>ScottPletcher</dc:creator></item><item><title>RE: set identity insert on</title><link>http://www.sqlservercentral.com/Forums/Topic1408997-392-1.aspx</link><description>How do you copy the data?With BCP OUT you can dump all tables into files (use -N option to convert all textual fields to unicode while keeping other fields native), and then bulk-load them with BCP IN.Speed i get on my laptop is about 200 000 rows per second for both directions.BCP also has -E option to preserve identity value: kind of automatic set identity insert on ... off for you.HTH,Vedran</description><pubDate>Sat, 19 Jan 2013 19:44:25 GMT</pubDate><dc:creator>Vedran Kesegic</dc:creator></item><item><title>RE: set identity insert on</title><link>http://www.sqlservercentral.com/Forums/Topic1408997-392-1.aspx</link><description>No. This is incredibly easy to evaluate. Create a table and try it out.[code]create table IdTest(	MyId int identity not null,	SomeValue varchar(10))insert IdTest select 'Row 1'SET IDENTITY_INSERT IdTest oninsert IdTest(MyId, SomeValue)select 2, 'New Value'SET IDENTITY_INSERT IdTest offinsert IdTestselect 'Final Test'Select * from IdTestdrop table IdTest[/code]Now unless your identity column is a primary key or has a unique index there is nothing to prevent duplicates.You can read about the Set IDENTITY_INSERT on BOL. [url=http://msdn.microsoft.com/en-us/library/ms188059.aspx]http://msdn.microsoft.com/en-us/library/ms188059.aspx[/url]</description><pubDate>Fri, 18 Jan 2013 10:09:01 GMT</pubDate><dc:creator>Sean Lange</dc:creator></item><item><title>set identity insert on</title><link>http://www.sqlservercentral.com/Forums/Topic1408997-392-1.aspx</link><description>I'm doing unicode conversion.   I am recreating a mirror image of some 100 databases and all their objects.  Before I create the objects, I am changing from varchar to nchar etc.  Then I do the copy from the old to new unicode database.  If I do an insert with identity insert on and then turn it off, do I need to do a reseed the identities?</description><pubDate>Fri, 18 Jan 2013 10:02:24 GMT</pubDate><dc:creator>Sailor</dc:creator></item></channel></rss>