• Sean Lange (9/27/2013)


    Then EXISTS is a good choice. Another option might be something like this.

    DECLARE @order INT = '1'

    DECLARE @col INT

    SELECT @col = col FROM Orders WHERE NumOrder = @order

    IF @col IS NOT NULL

    BEGIN

    END

    That might be a little simpler because you don't have to read the table more than once.

    Doh!!! 😀



    If you need to work better, try working less...