RecVersion delete
-- 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
Comments
Post a Comment