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 |
|
SQLFOX
Starting Member
45 Posts |
Posted - 2011-03-01 : 07:56:28
|
| Hi Guys,I'm having problems inserting data into the 'Departments' table that I created. I put a timestamp column into the table so that it would keep a record of the time each row was updated. Any advice?--Create Table-Create Table Departments(ID int Primary Key Not Null,Department Varchar(20) Null,Updated Timestamp Not Null)--Insert Data into Table--Insert Into Departments Values (1, 'Sales')--Error Message--Msg 273, Level 16, State 1, Line 1Cannot insert an explicit value into a timestamp column. Use INSERT with a column list to exclude the timestamp column, or insert a DEFAULT into the timestamp column. |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2011-03-01 : 08:01:07
|
As the error message says: Use INSERT with a column list to exclude the timestamp columninsert Departments(Id,Department)select 1,'Sales' No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2011-03-01 : 08:01:59
|
And be sure that timestamp is really what you want. It has nothing to do with a datetime column... No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
SQLFOX
Starting Member
45 Posts |
Posted - 2011-03-01 : 08:31:27
|
| Thanks. It seemed to work until I ran a select query and no results appeared. ;-( |
 |
|
|
SQLFOX
Starting Member
45 Posts |
Posted - 2011-03-01 : 08:33:27
|
| Got it! :-) |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2011-03-01 : 08:42:51
|
Fine  No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
|
|
|
|
|