Sunday, March 25, 2012

Default Date Value (today)

I have migrated from Access to SQL Server.
In Access I have default date value of today's date.

In SQL Server, it is empty (after migration).
What is the corresponding syntax (value) to default to
the current Date & Time in a DATETIME Field (using Design Table) ?

Thanks you.

Also, what is the difference between DATETIME and SMALLDATETIME
fields ?

Pierre.1.The function that returns the current timestamp is GETDATE()
2.datetime holds date and time from Jan 1,1753 to Dec 31,9999 with a three hundredth of a second accuracy
smalldatetime holds date and time from Jan 1, 1900 to June 6,2079 with accuracy to the minute, that fits with most applications.

Originally posted by Plarde
I have migrated from Access to SQL Server.
In Access I have default date value of today's date.

In SQL Server, it is empty (after migration).
What is the corresponding syntax (value) to default to
the current Date & Time in a DATETIME Field (using Design Table) ?

Thanks you.

Also, what is the difference between DATETIME and SMALLDATETIME
fields ?

Pierre.|||You can find this kind of info in the Books Online which is installed on your machine as you install sql server.|||An extra difference between datetime and smalldatetime types is for VB6 programmers. I've read somewhere that using smalldatetime gives problems in VB6 applications.

Ad.

Originally posted by dbadelphes
1.The function that returns the current timestamp is GETDATE()
2.datetime holds date and time from Jan 1,1753 to Dec 31,9999 with a three hundredth of a second accuracy
smalldatetime holds date and time from Jan 1, 1900 to June 6,2079 with accuracy to the minute, that fits with most applications.|||True its better to use DATETIME than the other with ADO/VB6.sql

No comments:

Post a Comment