I have a query that I need to run that is supposed to alter some of our tables and add columns to them; however, I was told that we may have problems because the tables are replicated. I searched and found information on sp_repladdcolumn, which it says to use instead of alter table.
So my question is, if I have something like what is below, can it be rewritten to use sp_repladdcolumn? and if so how? Do I do a separate statement for each column? would the index statement stay the same? and also not sure if I need @from_agent, @schema_change_script, @force_invalidate_snapshot,or @force_reinit_subscription
THANKS
ALTER TABLE [dbo].[User]
WITH NOCHECK ADD
[email_addr] [varchar] (50) NOT NULL DEFAULT ' ',
[logon] [datetime],
[logoff] [datetime]
CREATE INDEX [IX_User_2] on [dbo].[User] ([logon]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[ServArch]
WITH NOCHECK ADD
[runway] [char] (3) NOT NULL DEFAULT ' ',
[flag] [char] (2) NOT NULL DEFAULT '00' ,
[app1] [char] (2) NOT NULL DEFAULT '00',
[app2] [char] (2) NOT NULL DEFAULT '00'
GO
So my question is, if I have something like what is below, can it be rewritten to use sp_repladdcolumn? and if so how? Do I do a separate statement for each column? would the index statement stay the same? and also not sure if I need @from_agent, @schema_change_script, @force_invalidate_snapshot,or @force_reinit_subscription
THANKS
ALTER TABLE [dbo].[User]
WITH NOCHECK ADD
[email_addr] [varchar] (50) NOT NULL DEFAULT ' ',
[logon] [datetime],
[logoff] [datetime]
CREATE INDEX [IX_User_2] on [dbo].[User] ([logon]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[ServArch]
WITH NOCHECK ADD
[runway] [char] (3) NOT NULL DEFAULT ' ',
[flag] [char] (2) NOT NULL DEFAULT '00' ,
[app1] [char] (2) NOT NULL DEFAULT '00',
[app2] [char] (2) NOT NULL DEFAULT '00'
GO