• Note, @@FETCH_STATUS contains one of the following values:

    0: The FETCH statement was successful.

    -1: The FETCH statement failed or the row was beyond the result set.

    -2: The row fetched is missing.

    Therefore it's best to use

    WHILE @@FETCH_STATUS = 0

    The SQL Guy @ blogspot[/url]

    @SeanPearceSQL

    About Me[/url]