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 |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2002-04-01 : 09:19:01
|
| Frustrated writes "Hi there, I'm trying to insert into a table that has a timestamp field as a primary key. Selecting the table using the timestamp field can be done but the hard part is Inserting a timestamp value to it.Can you help me ? Is it possible to manually insert a timestamp value using T-SQL's INSERT ?" |
|
|
setbasedisthetruepath
Used SQL Salesman
992 Posts |
Posted - 2002-04-01 : 09:31:04
|
quote: Frustrated writes "Hi there, I'm trying to insert into a table that has a timestamp field as a primary key. Selecting the table using the timestamp field can be done but the hard part is Inserting a timestamp value to it.Can you help me ? Is it possible to manually insert a timestamp value using T-SQL's INSERT ?"
Sounds like what you're asking is how do I reference {now} in T-SQL - if that is your question, you can use getdate() ( or current_timestamp, which i prefer ).setBasedIsTheTruepath<O> |
 |
|
|
Jay99
468 Posts |
Posted - 2002-04-01 : 09:43:04
|
Be careful with your language . . . a 'timestamp' is a quote: A database-wide unique number. The storage size is 8 bytes.-BOL
If you have a timestamp column* in your table, 1.) it is a very poor choice for a primary key and 2.) you can not explicitly insert into it.If you mean that you have a datatime or smalldatetime typed column in you table, that is an entirely different thing.(footnote:)* tables don't have fields, they have columns - celkoJay<O> |
 |
|
|
|
|
|