SQL 2005/2008 and sp_add_jobstep fails The Next CEO of Stack OverflowCannot backup databases...

Would this house-rule that treats advantage as a +1 to the roll instead (and disadvantage as -1) and allows them to stack be balanced?

Does the Brexit deal have to be agreed by both Houses?

What is the purpose of the Evocation wizard's Potent Cantrip feature?

Trouble understanding the speech of overseas colleagues

How to write the block matrix in LaTex?

Why were Madagascar and New Zealand discovered so late?

Implement the Thanos sorting algorithm

How do I construct this japanese bowl?

Only print output after finding pattern

How to make a variable always equal to the result of some calculations?

How can I open an app using Terminal?

Is HostGator storing my password in plaintext?

What makes a siege story/plot interesting?

Go Pregnant or Go Home

Was a professor correct to chastise me for writing "Prof. X" rather than "Professor X"?

What is the point of a new vote on May's deal when the indicative votes suggest she will not win?

India just shot down a satellite from the ground. At what altitude range is the resulting debris field?

Describing a person. What needs to be mentioned?

Term for the "extreme-extension" version of a straw man fallacy?

What do "high sea" and "carry" mean in this sentence?

I believe this to be a fraud - hired, then asked to cash check and send cash as Bitcoin

Why doesn't a table tennis ball float on the surface? How do we calculate buoyancy here?

Where to find order of arguments for default functions

The King's new dress



SQL 2005/2008 and sp_add_jobstep fails



The Next CEO of Stack OverflowCannot backup databases from SQL Server 2008SQL 2008 Database mirroring over WAN link with certificatescannot login to sql express 2008 by sql authSQL Server 2008 Restore from Backup fails with error 3241 'cannot process this media family'SQL Alter database failed - being used by checkpoint processschedule backup and restore of SSAS 2008 databaseWhat would cause SQL 2008 Log Reader Agent to fail with “This process could not execute 'sp_replcmds' ”?How to properly re-add a windows administrator user to SQL ServerDatabase Copy Fails, but nothing fishy in the logsError on CMDEXEC job step even with proxy account defined












0















I have a job that is being created by a non-sysadmin user. This job fails because the @database_user_name setting with the error "Only a sysadmin can specify '@database_user_name' parameter"



If I read BOL this would be ignored in SQL 2008 R2 which I have confirmed I am running with @@version.



Any thoughts?



EXECUTE @ReturnCode = msdb.dbo.sp_add_jobstep @job_id = @JobID, @step_id = 1,
@step_name = N'Delete From TmpEmployee',
@command = N'Delete From TmpEmployee',
@database_name = @Database, @server = N'',
@database_user_name = N'',
@subsystem = N'TSQL', @cmdexec_success_code = 0, @flags = 0, @retry_attempts = 0,
@retry_interval = 1, @output_file_name = N'', @on_success_step_id = 2,
@on_success_action = 4, @on_fail_step_id = 0, @on_fail_action = 2
IF (@@ERROR <> 0 OR @ReturnCode <> 0) GOTO QuitWithRollback










share|improve this question














bumped to the homepage by Community 7 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.




















    0















    I have a job that is being created by a non-sysadmin user. This job fails because the @database_user_name setting with the error "Only a sysadmin can specify '@database_user_name' parameter"



    If I read BOL this would be ignored in SQL 2008 R2 which I have confirmed I am running with @@version.



    Any thoughts?



    EXECUTE @ReturnCode = msdb.dbo.sp_add_jobstep @job_id = @JobID, @step_id = 1,
    @step_name = N'Delete From TmpEmployee',
    @command = N'Delete From TmpEmployee',
    @database_name = @Database, @server = N'',
    @database_user_name = N'',
    @subsystem = N'TSQL', @cmdexec_success_code = 0, @flags = 0, @retry_attempts = 0,
    @retry_interval = 1, @output_file_name = N'', @on_success_step_id = 2,
    @on_success_action = 4, @on_fail_step_id = 0, @on_fail_action = 2
    IF (@@ERROR <> 0 OR @ReturnCode <> 0) GOTO QuitWithRollback










    share|improve this question














    bumped to the homepage by Community 7 mins ago


    This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.


















      0












      0








      0








      I have a job that is being created by a non-sysadmin user. This job fails because the @database_user_name setting with the error "Only a sysadmin can specify '@database_user_name' parameter"



      If I read BOL this would be ignored in SQL 2008 R2 which I have confirmed I am running with @@version.



      Any thoughts?



      EXECUTE @ReturnCode = msdb.dbo.sp_add_jobstep @job_id = @JobID, @step_id = 1,
      @step_name = N'Delete From TmpEmployee',
      @command = N'Delete From TmpEmployee',
      @database_name = @Database, @server = N'',
      @database_user_name = N'',
      @subsystem = N'TSQL', @cmdexec_success_code = 0, @flags = 0, @retry_attempts = 0,
      @retry_interval = 1, @output_file_name = N'', @on_success_step_id = 2,
      @on_success_action = 4, @on_fail_step_id = 0, @on_fail_action = 2
      IF (@@ERROR <> 0 OR @ReturnCode <> 0) GOTO QuitWithRollback










      share|improve this question














      I have a job that is being created by a non-sysadmin user. This job fails because the @database_user_name setting with the error "Only a sysadmin can specify '@database_user_name' parameter"



      If I read BOL this would be ignored in SQL 2008 R2 which I have confirmed I am running with @@version.



      Any thoughts?



      EXECUTE @ReturnCode = msdb.dbo.sp_add_jobstep @job_id = @JobID, @step_id = 1,
      @step_name = N'Delete From TmpEmployee',
      @command = N'Delete From TmpEmployee',
      @database_name = @Database, @server = N'',
      @database_user_name = N'',
      @subsystem = N'TSQL', @cmdexec_success_code = 0, @flags = 0, @retry_attempts = 0,
      @retry_interval = 1, @output_file_name = N'', @on_success_step_id = 2,
      @on_success_action = 4, @on_fail_step_id = 0, @on_fail_action = 2
      IF (@@ERROR <> 0 OR @ReturnCode <> 0) GOTO QuitWithRollback







      sql-server-2008






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 10 '11 at 16:22









      CWLCWL

      1




      1





      bumped to the homepage by Community 7 mins ago


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







      bumped to the homepage by Community 7 mins ago


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
























          1 Answer
          1






          active

          oldest

          votes


















          0














          Take out the @database_user_name = N'' parameter from the statement. When created, the job owner will be the login that ran the statement.



          You can then run sp_update_job @owner_login_name='MyLogin' to change the ownership. This can be run by a member of sysadmin someone in either the SQLAgentUserRole, SQLAgentReaderRole, or SQLAgentOperatorRole in msdb.



          Alternatively, add the user to one of the above msdb roles.






          share|improve this answer


























          • Thanks for that info, I have already done this for a test. The issue is the commands belong to a vendor and that will require a change request and we know sometimes this takes time.

            – CWL
            Mar 10 '11 at 17:25











          • Also, is BOL wrong that SQL 2008 R2 will ignore this? I was hoping sql 2008 R2 would be my fix.

            – CWL
            Mar 10 '11 at 17:25












          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "2"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f245781%2fsql-2005-2008-and-sp-add-jobstep-fails%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          Take out the @database_user_name = N'' parameter from the statement. When created, the job owner will be the login that ran the statement.



          You can then run sp_update_job @owner_login_name='MyLogin' to change the ownership. This can be run by a member of sysadmin someone in either the SQLAgentUserRole, SQLAgentReaderRole, or SQLAgentOperatorRole in msdb.



          Alternatively, add the user to one of the above msdb roles.






          share|improve this answer


























          • Thanks for that info, I have already done this for a test. The issue is the commands belong to a vendor and that will require a change request and we know sometimes this takes time.

            – CWL
            Mar 10 '11 at 17:25











          • Also, is BOL wrong that SQL 2008 R2 will ignore this? I was hoping sql 2008 R2 would be my fix.

            – CWL
            Mar 10 '11 at 17:25
















          0














          Take out the @database_user_name = N'' parameter from the statement. When created, the job owner will be the login that ran the statement.



          You can then run sp_update_job @owner_login_name='MyLogin' to change the ownership. This can be run by a member of sysadmin someone in either the SQLAgentUserRole, SQLAgentReaderRole, or SQLAgentOperatorRole in msdb.



          Alternatively, add the user to one of the above msdb roles.






          share|improve this answer


























          • Thanks for that info, I have already done this for a test. The issue is the commands belong to a vendor and that will require a change request and we know sometimes this takes time.

            – CWL
            Mar 10 '11 at 17:25











          • Also, is BOL wrong that SQL 2008 R2 will ignore this? I was hoping sql 2008 R2 would be my fix.

            – CWL
            Mar 10 '11 at 17:25














          0












          0








          0







          Take out the @database_user_name = N'' parameter from the statement. When created, the job owner will be the login that ran the statement.



          You can then run sp_update_job @owner_login_name='MyLogin' to change the ownership. This can be run by a member of sysadmin someone in either the SQLAgentUserRole, SQLAgentReaderRole, or SQLAgentOperatorRole in msdb.



          Alternatively, add the user to one of the above msdb roles.






          share|improve this answer















          Take out the @database_user_name = N'' parameter from the statement. When created, the job owner will be the login that ran the statement.



          You can then run sp_update_job @owner_login_name='MyLogin' to change the ownership. This can be run by a member of sysadmin someone in either the SQLAgentUserRole, SQLAgentReaderRole, or SQLAgentOperatorRole in msdb.



          Alternatively, add the user to one of the above msdb roles.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Mar 10 '11 at 17:24

























          answered Mar 10 '11 at 17:09









          squillmansquillman

          35.2k979134




          35.2k979134













          • Thanks for that info, I have already done this for a test. The issue is the commands belong to a vendor and that will require a change request and we know sometimes this takes time.

            – CWL
            Mar 10 '11 at 17:25











          • Also, is BOL wrong that SQL 2008 R2 will ignore this? I was hoping sql 2008 R2 would be my fix.

            – CWL
            Mar 10 '11 at 17:25



















          • Thanks for that info, I have already done this for a test. The issue is the commands belong to a vendor and that will require a change request and we know sometimes this takes time.

            – CWL
            Mar 10 '11 at 17:25











          • Also, is BOL wrong that SQL 2008 R2 will ignore this? I was hoping sql 2008 R2 would be my fix.

            – CWL
            Mar 10 '11 at 17:25

















          Thanks for that info, I have already done this for a test. The issue is the commands belong to a vendor and that will require a change request and we know sometimes this takes time.

          – CWL
          Mar 10 '11 at 17:25





          Thanks for that info, I have already done this for a test. The issue is the commands belong to a vendor and that will require a change request and we know sometimes this takes time.

          – CWL
          Mar 10 '11 at 17:25













          Also, is BOL wrong that SQL 2008 R2 will ignore this? I was hoping sql 2008 R2 would be my fix.

          – CWL
          Mar 10 '11 at 17:25





          Also, is BOL wrong that SQL 2008 R2 will ignore this? I was hoping sql 2008 R2 would be my fix.

          – CWL
          Mar 10 '11 at 17:25


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Server Fault!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f245781%2fsql-2005-2008-and-sp-add-jobstep-fails%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          As a Security Precaution, the user account has been locked The Next CEO of Stack OverflowMS...

          Список ссавців Італії Природоохоронні статуси | Список |...

          Українські прізвища Зміст Історичні відомості |...