acdagirl
asked on
is there a way to run a SQL job from a .net webfront?
Is there any way to run a SQL job in .net? I have DTS/SSIS scripts that are run through a SQL job and I was wondering how I could trigger these on command external to SQL - namely through a GUI?
ASKER
Actually I wanted to run it through the web front, not with any kind of T-SQL/SQL stuff... I want someone who has limited permissions to run this. Is it possible?
Yes - you just put this in a stored procedure (you can even pass the job name in as a parameter) and when they click 'Run Job' you execute the stored procedure and thus start the job.
I don't know of another way to hook into the SQL Agent system (haven't really looked anyway, as this will work, so there might be)
I don't know of another way to hook into the SQL Agent system (haven't really looked anyway, as this will work, so there might be)
ASKER
so to clarify:
I create a sp that includes
USE msdb
EXEC sp_start_job @job_name = 'Nightly Backup'
then call this sp from .net?
I create a sp that includes
USE msdb
EXEC sp_start_job @job_name = 'Nightly Backup'
then call this sp from .net?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
USE msdb
EXEC sp_start_job @job_name = 'Nightly Backup'
Give it a try (I imagine that you would run ExecuteNonQuery() here)