Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Ken Murphy
  Where is Ken Murphy?
 Springhill
 Canada
 Ken Murphy
 To: Andy Hug
  Where is Andy Hug?
 Bran
 Romania
 Andy Hug
 Tags
Subject: RE: SS2K5 SET IDENTITY_INSERT ON | OFF
Thread ID: 155121 Message ID: 155122 # Views: 1 # Ratings: 0
Version: Unknown Category: Databases, Tables and SQL Server
Date: Tuesday, December 25, 2007 12:01:15 PM         
   


> Hi everybody,
>
> hi
>
> i need to set the identity_insert on and off to a remote client table in order to insert rows into it
>
> the client table is on another server 500 miles away from the server ... and I want to insert some new rows into it but one column from client table has identity set to yes
>
> I'm asking because it should be trivial to do this ...
>
> set identity_insert server.database.table ON | OFF
>
> but for whatever reason it gives an error message

Andy,

The whole idea behind an identity column is that it is the responsiblity of the server to populate that field. I can see no reason for you to switch the identity on and off. Why do you need to assign a value for this field? If you simply INSERT INTO that table, the identity will be incremented normally for each new row. If you have three columns in your table, the first of which being the identity field, then all you need is an INSERT statement like this:

INSERT INTO MyTable (Field2, Field3) VALUES (?Value1, ?Value2)


Ken
You shall know the truth - and the truth shall set you free. (John 8:33)

ENTIRE THREAD

SS2K5 SET IDENTITY_INSERT ON | OFF Posted by Andy Hug @ 12/25/2007 11:44:36 AM
RE: SS2K5 SET IDENTITY_INSERT ON | OFF Posted by Ken Murphy @ 12/25/2007 12:01:15 PM
RE: SS2K5 SET IDENTITY_INSERT ON | OFF Posted by Andy Kramek @ 12/26/2007 12:12:33 PM