Problem assigning newid() as default value

Last Post 29 Mar 2004 04:53 AM by bcrnobrnja. 1 Replies.
AddThis - Bookmarking and Sharing Button Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
bcrnobrnja
New Member
New Member

--
29 Mar 2004 03:50 AM
I am running a replication where primary keys, identities, and default values are all dropped when the snapshot is created. Therefore, I have a pre and post script running to assign these to the snapshot. My problem is that my script to assign newid() as a default value to the msrepl_tran_version fails. It seems that sql server doesn't like a script that assigns newid() as a default value for the msrepl_tran_version field in multiple tables. For example, this part of my post script...

ALTER TABLE tbl1 ADD CONSTRAINT msreplDefault DEFAULT (newid()) FOR msrepl_tran_version
ALTER TABLE tbl2 ADD CONSTRAINT msreplDefault DEFAULT (newid()) FOR msrepl_tran_version
ALTER TABLE tbl3 ADD CONSTRAINT msreplDefault DEFAULT (newid()) FOR msrepl_tran_version
ALTER TABLE tbl4 ADD CONSTRAINT msreplDefault DEFAULT (newid()) FOR msrepl_tran_version

It has no problem adding the default constraint on the msrepl_tran_version field in only one table, but when trying to add the constraint to multiple tables my script fails.
bcrnobrnja
New Member
New Member

--
29 Mar 2004 04:53 AM
(path)\replicationscriptPOST_1.sql
Transaction sequence number and command ID of last execution batch are 0x00000D9A0000058D003600000001 and 17.

Tough to make anything of this error message, it's pretty much what you get when a script fails. I don't know if there's a way to catch a more descriptive error message.

SQL Server 2000, Service Pack 3a
You are not authorized to post a reply.

Acceptable Use Policy