Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
Trininole
Yak Posting Veteran
83 Posts |
Posted - 2010-05-12 : 14:53:52
|
| how would i Write a syntax that runs if today is Thursday and does not run if today is not Thursday??Roger DeFour |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2010-05-12 : 14:57:37
|
quote: Originally posted by webfred
if datename(dw, getdate()) <> 'Thursday'begin print 'no work today'endelsebegin print 'here we go'end No, you're never too old to Yak'n'Roll if you're too young to die.
No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
Trininole
Yak Posting Veteran
83 Posts |
Posted - 2010-05-12 : 14:59:31
|
| Thank youRoger DeFour |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2010-05-12 : 15:01:18
|
welcome  No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2010-05-12 : 15:12:54
|
But consider regional settings.In Germany the used statement would return 'Donnerstag' instead of 'Thursday'.You can avoid this by using for exampleset language englishin front of your statement.Have a look atselect DATEPART (dw, getdate())it returns the number of the day.today it returns 4.Also it depends on the setting of DATEFIRST:http://msdn.microsoft.com/en-us/library/ms181598.aspx No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
|
|
|