Need help with proc crossing servers

  • I am trying to build a stored procedure that will accept the database name and part of the table name through input parameters.  (This is to be used in the building of a test system from prod, and there is a table that has been split by calendar month into databases by calendar year.)

    I can get the stored proc to run successfully in a query window but I get the "Heterogeneous queries require the ANSI_NULLS ..." error when I attempt to execute the stored proc from within SQLAgent.  Can anyone help out?

  • when u create the SP, you need:

    SET ANSI_NULLS ON

    GO

    before your create procedure your_sp_name.

     

  • I set ANSI_NULLS and ANSI_WARNINGS on in both the create and within the stored procedure command string in order to get the procedure to create properly and execute in a query window.  There appears to be something else about executing with a command string.

    Again, I was able to create the stored procedure and can execute it in a query window.  The problem is encountered when I try the same syntax within a job step in SQLAgent. 

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply