March 9, 2006 at 6:35 am
Hey guys I have a question. Below I'm showing two basic date functions that can easily be applied as the default value of a field in a Microsoft Access table. Is it possible to do the exact same thing in a SQLServer table? And if so what would the fuctions look like? Any help you can provide would be appreciated.
As they appear in an Access table.
Field EffectiveDate default value: is Date()-(DatePart("d",Date()))
Field PostDate default value is: Date()
March 9, 2006 at 6:47 am
Hello Anthony,
The default in SQL Server are as follows:
Field PostDate default value is: Date()
which equals Getdate()
and
Field EffectiveDate default value: is Date()-(DatePart("d",Date()))
which equals Getdate()-(DatePart(d, Getdate()))
Thanks and have a great day!!!
Lucky
March 9, 2006 at 7:18 am
For defaults, the SQL Server equivalent of now() is GetDate() and the equivalent of date() is (convert(datetime,floor(convert(float,getdate()))))
March 9, 2006 at 7:22 am
Phil, thank you for helping me with this. You guys are really outstanding in the way your willing to give assistance!
March 9, 2006 at 7:24 am
lucky, the same goes for you man. Were it not for you guys I'd be stuck.
Viewing 5 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy