Wednesday, March 7, 2012

how to delete rowguid column from all the tables

how to delete rowguid column from all the tables after I remove the
replication...
Posted using the http://www.dbforumz.com interface, at author's request
Articles individually checked for conformance to usenet standards
Topic URL: http://www.dbforumz.com/Replication-...ict245867.html
Visit Topic URL to contact author (reg. req'd). Report abuse: http://www.dbforumz.com/eform.php?p=853106
Here's a query that can generate the drop column commands for all the guid
columns that are marked as rowguids. Copy the output from this statement,
make sure the output is correct, and run the output from Query Analyzer:
SELECT 'ALTER TABLE ' + QUOTENAME(TABLE_SCHEMA) + '.' +
QUOTENAME(TABLE_NAME) + ' DROP COLUMN ' + QUOTENAME(COLUMN_NAME )
FROM INFORMATION_SCHEMA.COLUMNS
WHERE DATA_TYPE = 'uniqueidentifier'
AND COLUMNPROPERTY(OBJECT_ID(TABLE_SCHEMA + '.' + TABLE_NAME), COLUMN_NAME,
'isRowGuidCol') = 1
AND OBJECTPROPERTY(OBJECT_ID(TABLE_SCHEMA + '.' + TABLE_NAME),
'isUserTable') = 1
HTH,
Vyas, MVP (SQL Server)
SQL Server Articles and Code Samples @. http://vyaskn.tripod.com/
"Vishy" <UseLinkToEmail@.dbForumz.com> wrote in message
news:4_853106_8612cb05dc2b54550aaf0687f2bfbcd3@.dbf orumz.com...
how to delete rowguid column from all the tables after I remove the
replication...
Posted using the http://www.dbforumz.com interface, at author's request
Articles individually checked for conformance to usenet standards
Topic URL:
http://www.dbforumz.com/Replication-...ict245867.html
Visit Topic URL to contact author (reg. req'd). Report abuse:
http://www.dbforumz.com/eform.php?p=853106
|||try this
http://groups-beta.google.com/group/...a?dmode=source
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"Vishy" <UseLinkToEmail@.dbForumz.com> wrote in message
news:4_853106_8612cb05dc2b54550aaf0687f2bfbcd3@.dbf orumz.com...
> how to delete rowguid column from all the tables after I remove the
> replication...
> --
> Posted using the http://www.dbforumz.com interface, at author's request
> Articles individually checked for conformance to usenet standards
> Topic URL:
http://www.dbforumz.com/Replication-...ict245867.html
> Visit Topic URL to contact author (reg. req'd). Report abuse:
http://www.dbforumz.com/eform.php?p=853106
|||Just to clarify, the above generated scripts may not work if the rowguid
column has any indexes or constraints associated with them. However, you
could use a similar query to script out the 'drop index/constraint'
statements.
HTH,
Vyas, MVP (SQL Server)
SQL Server Articles and Code Samples @. http://vyaskn.tripod.com/
"Narayana Vyas Kondreddi" <answer_me@.hotmail.com> wrote in message
news:%23YVEB3$mFHA.420@.TK2MSFTNGP09.phx.gbl...
Here's a query that can generate the drop column commands for all the guid
columns that are marked as rowguids. Copy the output from this statement,
make sure the output is correct, and run the output from Query Analyzer:
SELECT 'ALTER TABLE ' + QUOTENAME(TABLE_SCHEMA) + '.' +
QUOTENAME(TABLE_NAME) + ' DROP COLUMN ' + QUOTENAME(COLUMN_NAME )
FROM INFORMATION_SCHEMA.COLUMNS
WHERE DATA_TYPE = 'uniqueidentifier'
AND COLUMNPROPERTY(OBJECT_ID(TABLE_SCHEMA + '.' + TABLE_NAME), COLUMN_NAME,
'isRowGuidCol') = 1
AND OBJECTPROPERTY(OBJECT_ID(TABLE_SCHEMA + '.' + TABLE_NAME),
'isUserTable') = 1
HTH,
Vyas, MVP (SQL Server)
SQL Server Articles and Code Samples @. http://vyaskn.tripod.com/
"Vishy" <UseLinkToEmail@.dbForumz.com> wrote in message
news:4_853106_8612cb05dc2b54550aaf0687f2bfbcd3@.dbf orumz.com...
how to delete rowguid column from all the tables after I remove the
replication...
Posted using the http://www.dbforumz.com interface, at author's request
Articles individually checked for conformance to usenet standards
Topic URL:
http://www.dbforumz.com/Replication-...ict245867.html
Visit Topic URL to contact author (reg. req'd). Report abuse:
http://www.dbforumz.com/eform.php?p=853106

No comments:

Post a Comment