date whenever someone enters a record.
vjYou can add a default constraint for the column with a value consisting
of only the date portion of the CURRENT_TIMESTAMP (or GETDATE()). For
example:
ALTER TABLE MyTable
ADD CONSTRAINT DF_MyTable_MyDateColumn
DEFAULT
CAST(CONVERT(char(8), CURRENT_TIMESTAMP, 112) AS smalldatetime)
FOR MyDateColumn
--
Hope this helps.
Dan Guzman
SQL Server MVP
--------
SQL FAQ links (courtesy Neil Pike):
http://www.ntfaq.com/Articles/Index...epartmentID=800
http://www.sqlserverfaq.com
http://www.mssqlserver.com/faq
--------
"Vincent Jones" <vncntj@.hotmail.com> wrote in message
news:ba2a2d30.0310101710.94d2ff5@.posting.google.co m...
> How do i setup the table so that the default date enters the current
> date whenever someone enters a record.
> vj
No comments:
Post a Comment