Friday, March 9, 2012

Removing msrepl_trans columns from db

Hello,
Is there a way to remove the msrepl_tran columns from
tables that have been marked for replication?
I've a backup taken from a replicated system that I want
to remove all the replicated tables and columns from. I
can go through and delete the msrepl_tran columns and
constraint from the tables manually but it is very time
consuming to do 100 tables.
Can any one help?
Thanks in advance.
Enterprise Manager is your friend. Right click on your tables and remove
away.
You might also try to run a script like this.
select 'alter table '+ object_name(parent_obj) +' drop constraint '+name+
char(13)+' go'
From sysobjects where name like '%msrepl%' and type ='D' and
object_name(parent_obj)
<>'MSreplication_subscriptions'
GO
select 'alter table '+object_name(ID) +' drop column msrepl_tran_version '+
char(13) +'GO' from syscolumns where name like 'msrepl_tran_version%' and
object_name(ID) not like 'conflict%'
GO
Copy what appears in the results pane and then paste it in the execution
window and run it.
Hilary Cotter
Looking for a SQL Server replication book?
Now available for purchase at:
http://www.nwsu.com/0974973602.html
"Harvey" <anonymous@.discussions.microsoft.com> wrote in message
news:26d901c4dde2$9c58f700$a301280a@.phx.gbl...
> Hello,
> Is there a way to remove the msrepl_tran columns from
> tables that have been marked for replication?
> I've a backup taken from a replicated system that I want
> to remove all the replicated tables and columns from. I
> can go through and delete the msrepl_tran columns and
> constraint from the tables manually but it is very time
> consuming to do 100 tables.
> Can any one help?
> Thanks in advance.
|||Thanks for the replys. I have over 100 tables and
dropping one at a time would take way to long.
I'll use the cursor method and see how I get on. Thanks
again

>--Original Message--
>Enterprise Manager is your friend. Right click on your
tables and remove
>away.
>You might also try to run a script like this.
>select 'alter table '+ object_name(parent_obj) +' drop
constraint '+name+
>char(13)+' go'
>From sysobjects where name like '%msrepl%' and type ='D'
and
>object_name(parent_obj)
><>'MSreplication_subscriptions'
>GO
>select 'alter table '+object_name(ID) +' drop column
msrepl_tran_version '+
>char(13) +'GO' from syscolumns where name
like 'msrepl_tran_version%' and
>object_name(ID) not like 'conflict%'
>GO
>Copy what appears in the results pane and then paste it
in the execution
>window and run it.
>
>--
>Hilary Cotter
>Looking for a SQL Server replication book?
>Now available for purchase at:
>http://www.nwsu.com/0974973602.html
>"Harvey" <anonymous@.discussions.microsoft.com> wrote in
message[vbcol=seagreen]
>news:26d901c4dde2$9c58f700$a301280a@.phx.gbl...
want[vbcol=seagreen]
I
>
>.
>

No comments:

Post a Comment