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 |
|
Steve2106
Posting Yak Master
183 Posts |
Posted - 2011-11-10 : 10:30:10
|
| Hi There,In need of your help, again!I have a stored procedure that runs every day and I need it to run every Friday. I know I can setup a Job for this but I was wondering what the T-Sql code for this might be.I was thinking something like:DECLARE @DayName CHAR(10)SET @DayName = DATENAME(dw, GETDATE())if @DayName = 'Friday' BEGIN Select * from CustTable ENDBut when I execute that as a test I get a message "Command(s) completed successfully." I do not see the results of the select so I don't know if it worked or not.Is that syntax correct and how can I test it to get the results from the select on CustTable.Thanks again for your help.Best Regards,Steve |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-11-10 : 10:49:09
|
| the syntax looks fine and only when run on a friday it will return you some results------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
nigelrivett
Master Smack Fu Yak Hacker
3385 Posts |
Posted - 2011-11-10 : 10:49:11
|
| Run it on a Friday?==========================================Cursors are useful if you don't know sql.SSIS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
Steve2106
Posting Yak Master
183 Posts |
Posted - 2011-11-11 : 08:34:51
|
| Hi There,Thanks for the input.You were right of course, I was running the query on a Thursday.All looking good now.Thanks again for the help, I appreciate you taking the time.Best RegardsSteve |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-11-11 : 08:50:50
|
quote: Originally posted by Steve2106 Hi There,Thanks for the input.You were right of course, I was running the query on a Thursday.All looking good now.Thanks again for the help, I appreciate you taking the time.Best RegardsSteve
No problem ------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|