sql-server-job

How to start SQL Server job from a stored procedure?

陌路散爱 提交于 2019-12-19 12:49:09
问题 How can I create a stored procedure to start a SQL Server job? 回答1: You can execute the stored procedure sp_start_job in your stored procedure. See here: http://msdn.microsoft.com/en-us/library/ms186757.aspx 回答2: -- Create SQL Server Agent job start stored procedure with input parameter CREATE PROC uspStartMyJob @MyJobName sysname AS DECLARE @ReturnCode tinyint -- 0 (success) or 1 (failure) EXEC @ReturnCode=msdb.dbo.sp_start_job @job_name=@MyJobName; RETURN (@ReturnCode) GO OR with no

Special character in Sensitive SSIS Package Parameter String renders package invalid

…衆ロ難τιáo~ 提交于 2019-12-12 21:43:11
问题 I have a Sensitive String Parameter on an SSIS Package that is used to store a password for a remote server. However, the Job Agent throws an error whilst configuring the Package Parameters of that step when the string value contains a curly brace: Microsoft SQL Server Management Studio: Errors were detected in the command line arguments, please make sure all arguments are set correctly. (SqlManagerUI) The package works when it is directly executed in Visual Studio Data Tools, or when the {

How to catch the exit code of a CMDEXEC SQL Server Job?

泄露秘密 提交于 2019-12-10 19:08:38
问题 The following SQL Server job always exits with return code 0 indicating success, when in fact it does not do its job, i.e. it does not delete "test.txt". How can I catch the actual exit code (something like %ERRORLEVEL%, or a 'permission denied'-like message, or any meaningful response indicating success or failure of @command at msdb.dbo.sp_add_jobstep)? Remarks: {DBname} is the name of the database I am the owner of {proxyName} is the name of the SQL Server Agent Proxy (that is active to

How to start SQL Server job from a stored procedure?

被刻印的时光 ゝ 提交于 2019-12-01 15:13:02
How can I create a stored procedure to start a SQL Server job? You can execute the stored procedure sp_start_job in your stored procedure. See here: http://msdn.microsoft.com/en-us/library/ms186757.aspx -- Create SQL Server Agent job start stored procedure with input parameter CREATE PROC uspStartMyJob @MyJobName sysname AS DECLARE @ReturnCode tinyint -- 0 (success) or 1 (failure) EXEC @ReturnCode=msdb.dbo.sp_start_job @job_name=@MyJobName; RETURN (@ReturnCode) GO OR with no parameter: -- Create stored procedure to start SQL Server Agent job CREATE PROC StartMyMonthlyInventoryJob AS EXEC msdb