Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Execute job
Message
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Title:
Miscellaneous
Thread ID:
00847105
Message ID:
00848422
Views:
19
Change it to
CREATE PROCEDURE [Update_Datawarehouse] AS
EXEC msdb.dbo.sp_start_job @job_name = 'TRUNCATE DATAWAREHOUSE TABLES'
EXEC msdb.dbo.sp_start_job @job_name = 'PROPHECY TO DATAWAREHOUSE IMPORT'
>Hi All:
> I want to execute my jobs from the stored procedure I created.
>Here is my code
>
>CREATE PROCEDURE [Update_Datawarehouse] AS
>
>USE msdb
>EXEC sp_start_job @job_name = 'TRUNCATE DATAWAREHOUSE TABLES'
>EXEC sp_start_job @job_name = 'PROPHECY TO DATAWAREHOUSE IMPORT'
>
>I get an error 154, which reads" a USE database statement is not allowed in a procedure or trigger."
>
>Thus, my questions is how can I execute a job from stored procedure?
>Thanks
>MA
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform