Groups | Blog | Home
all groups > sql server replication > february 2006 >

sql server replication : sp_scriptdynamicupdproc creates timestamp column



Phill Anderson
2/10/2006 9:31:30 AM
I'm trying to use transactional replication between two Sql2000 sp4 servers.
Updates are failing, on the subscriber, on tables with the timestamp column.
I'm using sp_scriptdynamicupdproc to create the dynamic update stored
procedures. It is adding a timestamp column, to update, to the stored
procedure that it outputs.
I thought that the timestamp column was ignored in this version of sql
server.

Is there a way to make it so it does not add the timestamp column in the
update statement?

Phill Anderson
2/10/2006 3:07:27 PM
This is what I do:
I use sp_scriptdynamicupdproc, to create the dynamic update stored procedure
for the table with the timestamp.
I apply the new update stored procedure on the subscriber.
When transactional replication replicates an update to this table, I get the
following error: cannot update a timestamp column.

Hope this helps clarify what I'm doing.

Can I modify this stored procedure to not update timestamp columns?


Phill Anderson
2/10/2006 3:41:27 PM
Where in the update and insert proc's do I comment out the timestamp column?

-Phill

[quoted text, click to view]

Hilary Cotter
2/10/2006 6:25:13 PM
Actually the timestamp column is replaced with a varbinary(8) column on the
subscriber. If you want to keep a timestamp column on the subcsriber you
must edit the update and insert proc to comment out the timestamp column.

--
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

[quoted text, click to view]

Hilary Cotter
2/10/2006 7:43:15 PM
In the subscriber you will find procs of the form sp_MSins_ArticleName and
sp_MSupd_ArticleName

open these procs, for the insert proc you will find a parameter like this
@c3 binary(8). Note that on your proc it could be a different number, but
note the number which has the binary(8) data type.

Then in the insert statement remove the reference to the timestamp col, so
something like

insert into "TimeStampTable" ("pk", "charcol", "timestampcol") values (@c1,
@c2, @c3)

would become

insert into "TimeStampTable" ("pk", "charcol") values (@c1, @c2)

You would do something similar for the update proc.

--
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

[quoted text, click to view]

Phill Anderson
2/13/2006 8:11:33 AM
Thanks Hilary. One last question:
Is there any way this can be automated? My boss keeps telling me that this
should be a point and click thing to setup and that it should be easier than
I'm making it.

We have over 750 tables that have timestamp columns. I will be updating the
insert and update stored procedures on the subscriber for a week if I have to
do it manually. Why doesn't Microsoft provide an easier way to handle the
timestamp column?

--Phill Anderson

[quoted text, click to view]
AddThis Social Bookmark Button