Rowversion vs Timestamp !! what’s the word then microsoft?
I like to promote all things SQL Server whenever I can and when the subject of allocating some time to maintenance of our applications was raised I was quick to suggest we could replace the numerous Timestamp columns with Rowversion so that we future proof our application in that area.
Here’s the latest from BOL SQL 2008 R2
“Avoid using this feature …. “ – well no problem, I duly sent out an email to our developers explaining how we should be using rowversion and not timestamp……………. doh ! did I feel stupid when they asked how to add soemthing that wasn’t there ( GUI ) or got changed by SQL Server ( scripts )
Here’s the GUI
Look there it isn’t !! not a rowversion in sight .. no worries we’ll script it in then, that works …
create table dbo.testing
( numkey int,
Thedate datetime,
dbTimestamp rowversion
);
--Here’s the table scripted from SSMS after I’ve created it.
/****** Object: Table [dbo].[testing] ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[testing](
[numkey] [int] NULL,
[Thedate] [datetime] NULL,
[dbTimestamp] [timestamp] NOT NULL
) ON [PRIMARY]
GO
oh no it doesn’t – you can script your table with rowversion but it gets changed to Timestamp.
Now I don’t think this is very good at all, however it is consistent in as much as this is standard behaviour in SQL 2005, SQL 2008 and SQL 2008 R2, so that’s all right then!