Quantcast
Channel: StackExchange Replication Questions
Viewing all articles
Browse latest Browse all 17268

How to delete replication objects from db restored from subscriber backup

$
0
0

The db I use for development was restored from a merge replication subscriber. I would like to drop the replication indexes and constraints, and drop the rowguid column. When I execute the following script, I get the following success message:

(63 row(s) affected)
(70 row(s) affected)
(65 row(s) affected)

However, when I look at the tables, nothing has been dropped. Any assistance you can give regarding why the changes aren't taking place is greatly appreciated. The script I'm using is:

-- drop rowguid indexes

select 'drop index ' + sysobjects . name + '.' + sysindexes . name from    
sysindexes    
inner join sysobjects    
on sysindexes . id = sysobjects . id    
where objectproperty ( object_id ( sysobjects . name), 'IsMSShipped' ) = 0   
and sysindexes . indid > 0 and sysindexes . indid < 255 and ( sysindexes . status &  64)= 0    
and index_col ( sysobjects . name, sysindexes . indid, 1) = 'rowguid'
order by sysindexes . indid

-- remove rowguid default constraints

select 'alter table ' + b. name + ' drop constraint ' + a. name from    
sysobjects a    
inner join syscolumns on syscolumns . id = a. parent_obj   
inner join sysobjects b on syscolumns . id = b. id    
where syscolumns . name = 'rowguid'    
and objectproperty ( object_id ( b. name), 'IsMSShipped' ) = 0    
and a. xtype = 'D'

-- remove rowguid columns

select 'alter table ' + user_name ( sysobjects . uid)+ '.' + sysobjects . name + ' drop column rowguid ' from
    syscolumns
    inner join sysobjects on syscolumns . id = sysobjects . id
    where syscolumns . name = 'rowguid'
    and objectproperty ( object_id ( sysobjects . name), 'IsMSShipped' ) = 0

Thank you very much! ~~~Tracy


Viewing all articles
Browse latest Browse all 17268

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>