Quantcast
Channel: dBforums – Everything on Databases, Design, Developers and Administrators
Viewing all articles
Browse latest Browse all 13329

Run Stored Procedure Based on Day

$
0
0
I know you can use
Code:

SELECT datename(dw,getdate())
To get the day of the week. My question now is can you take that a step further and say something like
Code:

If datename(dw,getdate()) = 'Monday' Then
exec Monday_Procedure
Else
If datename(dw,getdate()) = 'Tuesday' Then
exec Tuesday_Procedure
End If
End If

I can't seem to get it to work in SQL Server, and from my googling I haven't found any supporting documentation that says it is possible either.

Viewing all articles
Browse latest Browse all 13329

Trending Articles