• PJ_SQL (7/29/2015)


    What is the purpose of creating table variable and inserting data into it and selecting from table variable inside of stored proc?

    Why can't the stored proc just have select statement instead of creating table variable?

    Most of the times I have seen this at clients it was because of developers who had no idea what they were doing. One client in fact had this pattern in about 90% of there over 2000 stored procedures!! Quite silly, but it made me look pretty good when they removed them at my recommendation. 😎

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