MERGE code works but not when called via stored procedure

  • Hello,

    I have a stored procedure that is only doing 1 thing - a MERGE command. When I run the code in the stored procedure, it is successful, as soon as I put the "CREATE PROCEDURE" around it and try to call it, nothing happens. Has anyone else ever come across this before?

    The Target is a table within the same database as the procedure, but the Source is coming from a query that crosses a linked server. Target is SQL 2014, Source is 2008 R2 SP3.

  • lk4772 (7/29/2016)


    Hello,

    I have a stored procedure that is only doing 1 thing - a MERGE command. When I run the code in the stored procedure, it is successful, as soon as I put the "CREATE PROCEDURE" around it and try to call it, nothing happens. Has anyone else ever come across this before?

    The Target is a table within the same database as the procedure, but the Source is coming from a query that crosses a linked server. Target is SQL 2014, Source is 2008 R2 SP3.

    Please more precisely define "nothing happens". Sproc fails to compile? Error when trying to execute? Execute successfully but no change occurs (when it should)?

    Did you profile the execution to see exactly what happened during the call itself (I would do a SPID filter and StatementCompleted event capture).

    Best,
    Kevin G. Boles
    SQL Server Consultant
    SQL MVP 2007-2012
    TheSQLGuru on googles mail service

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

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