Tags: authors, column, database, dbforumz, delete, http, interface, microsoft, mysql, oracle, rowguid, server, sql, tables, thereplication

how to delete rowguid column from all the tables

On Database » Microsoft SQL Server

5,934 words with 3 Comments; publish: Sat, 07 Jun 2008 19:46:00 GMT; (250109.38, « »)

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

All Comments

Leave a comment...

  • 3 Comments
    • 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 .sqlserver.questionfor.info. http://vyaskn.tripod.com/

      "Vishy" <UseLinkToEmail.sqlserver.questionfor.info.dbForumz.com> wrote in message

      news:4_853106_8612cb05dc2b54550aaf0687f2bfbcd3.sqlserver.questionfor.info.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

      #1; Sat, 07 Jun 2008 19:47:00 GMT
    • 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 .sqlserver.questionfor.info. http://vyaskn.tripod.com/

      "Narayana Vyas Kondreddi" <answer_me.sqlserver.questionfor.info.hotmail.com> wrote in message

      news:%23YVEB3$mFHA.420.sqlserver.questionfor.info.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 .sqlserver.questionfor.info. http://vyaskn.tripod.com/

      "Vishy" <UseLinkToEmail.sqlserver.questionfor.info.dbForumz.com> wrote in message

      news:4_853106_8612cb05dc2b54550aaf0687f2bfbcd3.sqlserver.questionfor.info.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

      #3; Sat, 07 Jun 2008 19:49:00 GMT