Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Assign a default value to the timestamp field in a stored procedure??

Status
Not open for further replies.

jgoodman00

Programmer
Jan 23, 2001
1,510
I have the following stored procedure:

Alter Procedure AppendAdopt
As
INSERT INTO ADOPT
SELECT ADOPT1.*
FROM ADOPT1;
return

I need to assign a default value of Null to the timestamp field. We only have Access 2000 & MSDE & as a result the help file seems a little 'sparse', & I cannot find an example of how I should declare this. ARRGGHHH

Please help with this apparently simple problem..... James Goodman
j.goodman00@btinternet.com
 
Hi James,
I don't think you can enter default (null) in timestamp column, if you are using select syntax.
But this can be approched by using the insert myTable values (....) syntax.
In your case you have to run following command in a loop (i.e. for all the rows of ADOPT1), like :
INSERT ADOPT (col1, col2, ..., myTimeStampColumn)
VALUES (col1_value, col2_value, ...,DEFAULT)


 

I don't believe you can insert a NULL into a Timestamp column. Timestamp is s special data type that is updated everytime a row is inserted or updated. Even if you insert a NULL, SQL Server is going to update the column value to a unique value for the database. Terry L. Broadbent
faq183-874 contains some tips and ideas for posting questions in these forums. Please review it if you have time.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top