• Hi Andy,

    Thomas Keller is absolutely right and explained it very well.

    I chose SELECT COUNT(*) because that aggregate function will normally always return a row with a non-null value. That means that I could be sure that if the variable is null, the query did not return any rows, and FMTONLY was set.

    The code is improved if @SetFmtOnly is explicitly initialised (as in Thomas's example)

    Renato Buda