Thursday, March 8, 2012

Adding new field in a table which being used for replication

Hi dear friends,
I'm trying to add a new field in a table and in my desired
position (OrdinalPosition), but I can not and I get the
following error message. As this table is involved in
replication I get this error message:
('tblTransPayments' table
- Unable to modify table.
ODBC error: [Microsoft][ODBC SQL Server Driver][SQL Server]
Cannot drop the table 'dbo.tblTransPayments' because it is
being used for replication.)
It should be noticed that I have lots of data in this
table and I'm not going to drop the table.
I can easily add my new field at the end of the column's
list but not as 21th column which I want to.
Thanks in advance.
If you really need the new column at a specific position, you'll have to drop the subscription, drop the publication, add the column then recreate the publication and subscription and initialize. You might want to do a nosync initialization to avoid the c
ost of the snapshot, but in this case you'll have to add the column onto the subscriber(s) table manually and if you are doing transactional replication, you'll need to create the scripts and apply them manually.
(No doubt you've seen this in other threads, but referring to columns by position rather than by name is generally seen as being a restrictive practice.)
HTH,
Paul Ibison
|||Hi -
Please check SQL BOL for "sp_repladdcolumn" and "sp_repldropcolumn".
Thanks
-Surajit
"Mattew" <anonymous@.discussions.microsoft.com> wrote in message
news:19d4101c44d7b$6507c260$a101280a@.phx.gbl...
> Hi dear friends,
> I'm trying to add a new field in a table and in my desired
> position (OrdinalPosition), but I can not and I get the
> following error message. As this table is involved in
> replication I get this error message:
> ('tblTransPayments' table
> - Unable to modify table.
> ODBC error: [Microsoft][ODBC SQL Server Driver][SQL Server]
> Cannot drop the table 'dbo.tblTransPayments' because it is
> being used for replication.)
> It should be noticed that I have lots of data in this
> table and I'm not going to drop the table.
> I can easily add my new field at the end of the column's
> list but not as 21th column which I want to.
> Thanks in advance.
|||Surajit,
this won't give the ability to specify the position, and Matthew doesn't
want the column created at the end.
Regards,
Paul Ibison

No comments:

Post a Comment