Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Microsoft SQL Server > Re: copying dat...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 5 of 10 Topic 10986 of 11420
Post > Topic >>

Re: copying data from one server to another

by Erland Sommarskog <esquel@[EMAIL PROTECTED] > May 16, 2008 at 08:04 PM

(imorxr@[EMAIL PROTECTED]
) writes:
> That command executes without error, but the problem is that I cannot
> perform the actual insert, because it is not within the execute
> statement. In other words, the following doesn't work:
> 
> EXECUTE [remoteservername].Library2005.dbo.sp_executesql N'SET
> IDENTITY_INSERT dbo.tblLanguages ON'

This is because the effect of a SET command is reverted when the
scope in which the SET command is executed exists. You would
need to have the SET command and the INSERT statement in the 
same batch.

Overall, this is a good example how IDENTITY can buy you a load of 
troubles. Had you rolled your own, you would have copied the data
long ago.

-- 
Erland Sommarskog, SQL Server MVP, esquel@[EMAIL PROTECTED]
 Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
 




 10 Posts in Topic:
copying data from one server to another
Guineapig1980@[EMAIL PROT  2008-04-22 06:11:12 
Re: copying data from one server to another
"Plamen Ratchev"  2008-04-22 09:49:52 
Re: copying data from one server to another
imorxr@[EMAIL PROTECTED]   2008-05-14 21:52:28 
Re: copying data from one server to another
"Plamen Ratchev"  2008-05-15 01:40:33 
Re: copying data from one server to another
Erland Sommarskog <esq  2008-05-16 20:04:24 
Re: copying data from one server to another
imorxr@[EMAIL PROTECTED]   2008-05-14 23:18:58 
Re: copying data from one server to another
imorxr@[EMAIL PROTECTED]   2008-05-14 23:25:58 
Re: copying data from one server to another
imorxr@[EMAIL PROTECTED]   2008-05-15 01:35:39 
Re: copying data from one server to another
"Plamen Ratchev"  2008-05-15 09:01:18 
Re: copying data from one server to another
imorxr@[EMAIL PROTECTED]   2008-05-15 20:06:59 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Oct 11 8:48:14 CDT 2008.