I've recently been porting a little php / mysql script over to asp / mssql and I've got issues with the timestamp data type. With mysql i could easily insert 01:01:01 into the timestamp column, however mssql throws an error and whats the string passed in to be converted into a timestamp data type.
Is this the right datatype to use? I read somewhere that the timestamp column is readonly and is updated each time the record is updated, if this is the case then i shouldn't be using the timestamp column. But then I'm posed with the problem that when I select and display the records how do i sort them by the lowest time?
I'm creating a a highscores table, the lowest time being the highest score.
Here is my current mssqyl statement:
Expand|Select|Wrap|Line Numbers
- sqlStatement = "INSERT INTO scores (name,email,usertime,milliseconds) VALUES('" & fName & "','" & fEmail & "',CAST('" & fTime & "' as timestamp),'" & fMilliseconds & "')"
Expand|Select|Wrap|Line Numbers
- Cannot insert a non-null value into a timestamp column. Use INSERT with a column list or with a default of NULL for the timestamp column.