Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
bobbabuoy
Starting Member
33 Posts |
Posted - 2004-06-18 : 21:04:04
|
Can anyone give me a brief summary of this datatype? Anything that I would need to know to use this in tables that are populated via an asp web service.Thanks! |
|
ValterBorges
Master Smack Fu Yak Hacker
1429 Posts |
Posted - 2004-06-18 : 21:37:01
|
From BOL:timestamptimestamp is a data type that exposes automatically generated binary numbers, which are guaranteed to be unique within a database. timestamp is used typically as a mechanism for version-stamping table rows. The storage size is 8 bytes.RemarksThe Transact-SQL timestamp data type is not the same as the timestamp data type defined in the SQL-92 standard. The SQL-92 timestamp data type is equivalent to the Transact-SQL datetime data type. A future release of Microsoft® SQL Server™ may modify the behavior of the Transact-SQL timestamp data type to align it with the behavior defined in the standard. At that time, the current timestamp data type will be replaced with a rowversion data type.Microsoft® SQL Server™ 2000 introduces a rowversion synonym for the timestamp data type. Use rowversion instead of timestamp wherever possible in DDL statements. rowversion is subject to the behaviors of data type synonyms. For more information, see Data Type Synonyms.In a CREATE TABLE or ALTER TABLE statement, you do not have to supply a column name for the timestamp data type:CREATE TABLE ExampleTable (PriKey int PRIMARY KEY, timestamp)If you do not supply a column name, SQL Server generates a column name of timestamp. The rowversion data type synonym does not follow this behavior. You must supply a column name when you specify rowversion.A table can have only one timestamp column. The value in the timestamp column is updated every time a row containing a timestamp column is inserted or updated. This property makes a timestamp column a poor candidate for keys, especially primary keys. Any update made to the row changes the timestamp value, thereby changing the key value. If the column is in a primary key, the old key value is no longer valid, and foreign keys referencing the old value are no longer valid. If the table is referenced in a dynamic cursor, all updates change the position of the rows in the cursor. If the column is in an index key, all updates to the data row also generate updates of the index.A nonnullable timestamp column is semantically equivalent to a binary(8) column. A nullable timestamp column is semantically equivalent to a varbinary(8) column. |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2004-06-19 : 13:17:13
|
If you don't know what it is why do you want to use it? What do you expect it from it?==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
|
|
samtoffa
Yak Posting Veteran
60 Posts |
Posted - 2004-06-23 : 09:31:52
|
I assume that you are trying to use this in a similar way to the 'autonumber' feature of MS Access. If this is the case and you are looking to autonumber submitted web forms, my advice is find another way to do it!! I had some bad experiences with handling this datatype in .asp pages so perhaps the best thing is to write an autonumbering procedure/trigger etc??? |
|
|
JimL
SQL Slinging Yak Ranger
1537 Posts |
Posted - 2004-06-23 : 09:53:30
|
The only time I have this data type in one of my DBs is for SQL Server Replication and SQL automatically added to the table as part of the SQL Replication process.JimUsers <> Logic |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2004-06-23 : 10:51:14
|
The equivalent of autonumber is identity.Timestamp is used to detect the order in which rows have changed.==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
|
|
|
|
|
|
|