Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can I alter a replicated table in SQL Server 2000

Status
Not open for further replies.

cocopud

Technical User
Jan 8, 2002
139
US
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
 
Yes that you be rewritten using the sp_repladdcolumn. Each column will need it's own stored proc execution.

I'd recommend making the change within the replication UI. That way you can be sure to get the options correct.

Denny
MCSA (2003) / MCDBA (SQL 2000)
MCTS (SQL 2005 / Microsoft Windows SharePoint Services 3.0: Configuration / Microsoft Office SharePoint Server 2007: Configuration)
MCITP Database Administrator (SQL 2005) / Database Developer (SQL 2005)

My Blog
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top