Different results with procedure and query

  • I have a very odd issue, when a procedure runs it leaves off a specific set of rows.  When I run the exact code out of the procedure I get the correct data set.  Has anyone else seen this or can speculate as to why?
    SQL 2012 std
    No variables
    No clue....

    There is an exception to every rule, except this one...

  • Post the code

  • This was removed by the editor as SPAM

  • Also, look at the execution plans, specifically the ANSI settings (located in the first operator's properties). See if they're different. That could result in differences in data depending on the query and the settings. Also, just compare the plans to see what/how/why the optimizer is putting things together. At the core of it all, they can't be identical. Something is different, not just "in a proc"/"as a batch".

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

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

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