sql server replication:
[quoted text, click to view] > -- Set the IDENTITY_INSERT to ON before running Distribution Agent. If
> yes, how to do that.
You can modify the sp_MSins_tablename stored procedure, adding something
like this:
create procedure sp_MSins_tablename as
if not exists (select * from tablename where col1 = @c1 and col2 = @c2 and
....... ) -- include all PK keys here
begin
set identity_insert tablename on
insert into tablename (col1, col2....) values (@c1, @c2...)
end
[quoted text, click to view] > -- I am not sure if the identity columns were created using the NOT FOR
> REPLICATION option. How can I now approach this situation?
To tell if the table was created as "not for replication", right click on
table and choose "All Tasks" and then generate SQL script. Click on
"Preview" button and you'll be able to see its schema script.
How can I
[quoted text, click to view] > mark identity columns - "Not For Replication" ?
> I have seen a hack solution using the syscolumns table! Has this worked
> for anyone? if yes, can u please some shed light on it!!
I usually run schema script with "not for replicaton" on the subscriber
BEFORE I create the table. But you obviously wan to avoid doing this. The
hacking way of making it to look like "not for rep" is to update the colstat
value from 1 to 9 in syscolumn table. But I 've never tested on the real
replication. You risk fixing unwanted problems on your own. I suggest
breaking the replicatin, renaming the existing table, creating new table
with "not for replicaton" , copying data from old table and resetting up the
replication.
HTH.
Richard