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.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 execute sql job in sp

Author  Topic 

arkiboys
Master Smack Fu Yak Hacker

1433 Posts

Posted - 2013-10-10 : 05:40:34
Hello,
I would like to have a stored procedure in a database which executes the sql job. This will be called from the GUI by a user.
But it seems I can not use the msdb in another database?

create procedure uspSSIS_Execute

@SQLJobName varchar(100) = 'DownloadData'

USE msdb ;
GO

EXEC dbo.sp_start_job @job_name = @SQLJobName ;
GO

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-10-10 : 05:54:02
this?

Create procedure uspSSIS_Execute

@SQLJobName varchar(100) = 'DownloadData'
AS

EXEC msdb.dbo.sp_start_job @job_name = @SQLJobName ;
GO



------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

arkiboys
Master Smack Fu Yak Hacker

1433 Posts

Posted - 2013-10-11 : 03:20:44
quote:
Originally posted by visakh16

this?

Create procedure uspSSIS_Execute

@SQLJobName varchar(100) = 'DownloadData'
AS

EXEC msdb.dbo.sp_start_job @job_name = @SQLJobName ;
GO



------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs



Thanks
Go to Top of Page
   

- Advertisement -