Wednesday, March 7, 2012

Alter Columns for Replication

I want to programmatically change the IDENTITY cols in my subscriber tables to NOT FOR REPLICATION. I want to use SQL code for this since there are many tables and cols and I want to be able to reverse the process.
I can't get the ALTER TABLE ALTER COLUMN syntax correct - it seems that I can't use this command to change the IDENTITY props, only field type, width, etc. Similarly I don't see any stored procs that do this. Can anyone provide the correct syntax or anoth
er solution?
TIA, P
Perry,
unfortunately this is not possible. EM makes it see that it is possible, but
behind the scenes it copies the contents of the table into a temporary table
with the required attribute then renames the table.
Regards,
Paul Ibison
|||Drat. I thought that might be the case.
Thanks for the help.
Perry
-- Paul Ibison wrote: --
Perry,
unfortunately this is not possible. EM makes it see that it is possible, but
behind the scenes it copies the contents of the table into a temporary table
with the required attribute then renames the table.
Regards,
Paul Ibison
|||Perry,
I've just thought of something - I seem to remember that Hilary has posted
up a backdoor method of doing this by editing the system table directly. I
can't vouch for this as I haven't used it, but you'll find it in one of
Hilary's posts. If you can't find it then please post up a message directly
for Hilary.
HTH,
Paul Ibison
|||try this. this is for a single table
http://groups.google.com/groups?hl=e...TNGP12.phx.gbl
this is for all tables
http://groups.google.com/groups?hl=e... NGP12.phx.gbl
Hilary Cotter
Looking for a book on SQL Server replication?
http://www.nwsu.com/0974973602.html
"Perry Graham" <anonymous@.discussions.microsoft.com> wrote in message
news:4419796F-4968-4BAB-8B0E-12C104BDAE72@.microsoft.com...
> I want to programmatically change the IDENTITY cols in my subscriber
tables to NOT FOR REPLICATION. I want to use SQL code for this since there
are many tables and cols and I want to be able to reverse the process.
> I can't get the ALTER TABLE ALTER COLUMN syntax correct - it seems that I
can't use this command to change the IDENTITY props, only field type, width,
etc. Similarly I don't see any stored procs that do this. Can anyone provide
the correct syntax or another solution?
> TIA, P

No comments:

Post a Comment