0

I am using SQL Server 2017.

I can call a SQL Agent job named MySQLAgent_Job using the below SQLCMD

SQLCMD -E -SMySQLServer -Q "msdb.dbo.sp_start_job N'MySQLAgent_Job'"

Is it possible to pass in a parameter to MySQLAgent_Job thru this command ?

Something like below:

SQLCMD -E -SMySQLServer -Q "msdb.dbo.sp_start_job N'MySQLAgent_Job FirstParm'"

Thank you

faujong
  • 949
  • 4
  • 24
  • 40
  • 2
    If you can’t, you could always store values in a table. – Dai Aug 10 '21 at 22:49
  • 3
    Agent jobs are meant to be run unattended, at which point you can't. – Alejandro Aug 10 '21 at 22:54
  • Try: https://www.mssqltips.com/sqlservertip/5731/how-to-pass-data-between-sql-server-agent-job-steps/ OR https://www.google.com/search?client=firefox-b-d&q=pass+a+parameter+to+a+SQL+Agent+job –  Aug 11 '21 at 05:59

0 Answers0