• Eric M Russell (4/23/2014)


    In addition to the issue pointed out by Sean, that the variable will not get assigned if there is no result returned from MyTable, you also need to supply an ORDER BY clause when using the TOP clause, or else the specific value returned won't be deterministic.

    Thank you for the information.

    This was for a quick test and I did not care what was selected, just that something was selected. My test was on a PK. For the test I even used WHERE 1 = 2.:-)