Ignore ROWGUID/ROWGUIDCOL columns
bluebird84
Posts: 10 New member
Hi,
I'm comparing our non-replicated Development database with our replicated UAT Database - using the compare I'd like to update the schema of the Replicated Database (new columns, new tables, new and altered stored procedures etc).
The issue I'm having is that the ROWGUID columns in the Development database are set to NEWID() and in UAT they have been changed by Replication to NEWSEQUENTIALID(). Therefore the comparison is pretty useless as it shows a difference in all tables.
Does anyone have a way around this, apart from manually editing the scripts generated? A way of ignoring the ROWGUIDCOL columns maybe? ('unmapping' the rowguid from each table)?
many thanks
I'm comparing our non-replicated Development database with our replicated UAT Database - using the compare I'd like to update the schema of the Replicated Database (new columns, new tables, new and altered stored procedures etc).
The issue I'm having is that the ROWGUID columns in the Development database are set to NEWID() and in UAT they have been changed by Replication to NEWSEQUENTIALID(). Therefore the comparison is pretty useless as it shows a difference in all tables.
Does anyone have a way around this, apart from manually editing the scripts generated? A way of ignoring the ROWGUIDCOL columns maybe? ('unmapping' the rowguid from each table)?
many thanks
Comments
I wasn't getting the order of the constraints or ALTER table statements correct which was causing the column creation to fail, but I think I've got the order correct now.
drop the newID() rowguid
ALTER TABLE dbo.[table1] ADD rowguid uniqueidentifier
ALTER TABLE [dbo].[table1] ADD CONSTRAINT [DF_table1_rowguid] DEFAULT (newsequentialid()) FOR [rowguid]
ALTER TABLE dbo.[table1] ALTER COLUMN rowguid uniqueidentifier NOT NULL
ALTER TABLE dbo.[table1] ALTER COLUMN rowguid ADD ROWGUIDCOL