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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

alter statement

Status
Not open for further replies.

s4dadmin

Programmer
Apr 27, 2003
107
0
0
US
I have an alter statement that I am using which is giving me the error "Incorrect syntax near the keyword 'DEFAULT'" The current field eventSubmissionDate is the data type timestamp

Code:
alter table tbl_Events ALTER COLUMN eventSubmissionDate datetime not null DEFAULT getdate()

Quincy
 
Amongst other things the altered column cannot be:

A column with a text, image, ntext, or timestamp data type.

Refer BOL
 
To alter a timestamp to something else, create a new column that is the type you want with the default value you want. drop the old column, rename the new column using sp_rename.

Unless this is a new development and there are no real records yet, this process will result in every current record having the current data. Is this what you want? And are you sure you want to delete the timestamp colum? Will will lose what dat is in it and it may break outher parts of your application expecially if you are using replication.

Questions about posting. See faq183-874
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top