Dropping rowguid

  • This is probably me being dense, but I have a database that used to be replicated. It has the rowguid column used for replication on most of the tables. I need to drop this column using T-SQL and my statement is:

    ALTER TABLE ACCOUNTING DROP COLUMN rowguid

    but i get an error message back saying:

    Server: Msg 170, Level 15, State 1, Line 1

    Line 1: Incorrect syntax near 'rowguid'.

    I think the syntax is fine, so what am i missing??

  • The sintax looks good to me.. try using [] in [rowguid].

    If the merge process created this column, see if the error is something about that this column is been referenced by another object. A view or MSMerge_Contents sys tables uses this columns. Check to drop first any object referencing that column

  • I tried the [] beforehand, no luck there..

    problem is the database had replication dropped, and the the database was copied across to an SQL2000 server. The MSMerge_contents doesn't even exist there...

    how else would i find an referencing objects? And if that were the case, why would i be getting the error just from parsing the statement?

  • Check to see if there is a constraint on rowguid. Also, I believe there will be an index pointing to rowguid, which will need to be deleted.

    Also, if you try deleting the rowguid in Enterprise Manager, and if you truly are not replicating, EM will allow the delete. EM seems to remove the constraints imposed on you by a rowguid that replication added.

  • Try Dropping the column through Enterprise Manager. This doesn't Alter Table, but scripts a new table, transfers the data and then drops the original and renames the new. Script the changes using the button in the table designer and you can see what it does.

    If this is a script that you wish to roll out to several servers make sure that you test the script a few times as I have found occasions where this script is not portable, especially for data in related tables.

    Edited by - ed harling on 09/30/2003 02:39:34 AM

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply