May 16, 2010 at 4:16 pm
Hi team,
Server OS = Win 2008
SQL Server = 2008
I need to provide a user with the ability to launch a SQL Job on demand from their desktop. Ideally double click an icon to set the job running.
How could I do this. Sorry I really don't know where to start. If I need to create some sort of batch file then sample code for the batch file would be greatly appreciated.
Thanks
R
May 16, 2010 at 5:23 pm
Assuming the user has permission to execute job with in SQL Server; I think you can simply use sp_start_job.
So make sure the user has SQL Server client tools installed on thier computer.
Create a batch file with following command...
SQLCMD -SServerName -dmsdn -E -Q"EXEC dbo.sp_start_job 'JOBNAME'"
This is assuming that they have permissions to the job, and it is using trusted connection. Since it is command file I wouldn't recommend anything else.
If user doesn't have direct access another way I have done it is used Windows Scheduler; create a batch file using "-E". And create a job in the scheduler that is created under a service account credential. Then user has to just right click on that job and click execute.
Mohit K. Gupta, MCITP: Database Administrator (2005), My Blog, Twitter: @SQLCAN[/url].
Microsoft FTE - SQL Server PFE
* Some time its the search that counts, not the finding...
* I didn't think so, but if I was wrong, I was wrong. I'd rather do something, and make a mistake than be frightened and be doing nothing. :smooooth:[/font]
May 16, 2010 at 5:30 pm
Thanks Mohit, will give this a try. Appreciate you taking the time to reply.
Cheers Ryan 🙂
May 21, 2010 at 7:48 am
I use the SQL Scheduler job for my "SQL Automation Engine" I designed. Works pretty slick ;-).
So I would go with scheduler route :D.
- Mohit.
Mohit K. Gupta, MCITP: Database Administrator (2005), My Blog, Twitter: @SQLCAN[/url].
Microsoft FTE - SQL Server PFE
* Some time its the search that counts, not the finding...
* I didn't think so, but if I was wrong, I was wrong. I'd rather do something, and make a mistake than be frightened and be doing nothing. :smooooth:[/font]
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply