Comparing results

  • Hi recently we converted one of function into sp.

    While doing unit test, I have to make sure both will come same result. How can I compare without manually

    select * from dbo.Testfn (1,8)

    except

    execute dbo.Test_SP 1,8

  • Create a temporary table or a table variable to put the results into. Run the query, do a JOIN to compare the results. You can use

    INSERT INTO #X -- or @X

    (col1,col2)

    EXEC dbo.MyProc

    You just have to define the table with the correct columns and data types ahead of calling the procedure. Not a problem.

    "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

  • Thank you

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

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