You can use the OBJECTPROPERTY()
function in SQL Server to check whether or not a table has a timestamp column.
To do this, pass the table’s object ID as the first argument, and TableHasTimestamp
as the second argument. The function returns a 1
or a 0
depending on whether or not it has a timestamp column.
A return value of 1
means that the table does have a timestamp column, and a value of 0
means that doesn’t.
This also works for columns that have been defined as rowversion (timestamp is the deprecated synonym for rowversion).