To create a Transact-SQL job step
- In Object Explorer , connect to an instance of the SQL Server database engine, and then expand the instance.
- expand "SQL Server proxy " properties
- in " Job properties " dialog box, click " step " page, then click new "
- In the new job step dialog box, type the step name for the job.
- In the type List, click Transact- SQL script (TSQL).
- In the command box, type the Transact-SQL Batch command, or click Open , Select a transact -SQL file to use as a command.
- Click analyze to check the syntax.
- If the syntax is correct, " analysis succeeded " message. If an error is found, correct the syntax before continuing.
- Click " advanced " page to set job step options, such as actions to take when job steps succeed or fail, sql Server The number of times the agent can attempt to execute a job step and sql Server The file or table that the agent can write the job step output to. Only sysadmin SQL Server The delegate user can write the output to the table.
- If you are a member of the sysadmin fixed server role and you want to run this job step as a different SQL login, run from " as the following user " list, select the SQL login name.
To create a Transact-SQL job step