I need some information on SQL Server timestamp.

I found all the required information here.

The article says

The timestamp syntax is deprecated. This feature will be removed in a future version of Microsoft SQL Server. Avoid using this feature in new development work, and plan to modify applications that currently use this feature.

Sample syntax is to create timestamp column is

CREATE TABLE ExampleTable (PriKey int PRIMARY KEY, timestamp);

The new syntax is

CREATE TABLE ExampleTable2 (PriKey int PRIMARY KEY, VerCol rowversion) ;

So the question is, the word deprecated means Is Microsoft going to completely remove the timestamp datatype or it is removing just the syntax of using it ?

As I am using SQL Server 2014, in Design mode, I am still able to see timestamp datatype.

So can someone please clarify my doubt ?

And also is there any alternative datatype for timestamp, I want to use it for concurrency check ?

  • Related: dba.stackexchange.com/questions/86523/… – Andriy M Jun 28 '16 at 14:18
  • 1
    I don't really get the question in your last sentence. "is there any alternative datatype for timestamp" – you've said it yourself that the new syntax is rowversion. That's the alternative you should use. – Andriy M Jun 28 '16 at 14:21
  • Note that while Microsoft has been saying for multiple versions that timestamp keyword (NOT the functionality!) is deprecated, even in SQL Server 2016 if you create a table using rowversion, the metadata still stores timestamp and that's what you'll get if you, for example, script out the table. – Aaron Bertrand Jun 28 '16 at 14:53
  • @andriy my last question was alternative data type for time stamp, not syntax. :) – J Santosh Jun 28 '16 at 15:57

Only the timestamp syntax is deprecated, not the whole datatype. According to this, just use the rowversion syntax going forward.

For concurrency checks, rowversion is what you're looking for. The timestamp synonym still works, but is just an alternate name for rowversion. There are no other datatypes that behave similarly.

  • Thanks all. Actually in gui, I didn't find rowversion , that's where i confused. – J Santosh Jun 28 '16 at 15:55
  • 1
    @JSantosh Yeah, the table designer is terrible. Just don't use it. – Aaron Bertrand Jun 28 '16 at 19:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.