• Hugo Kornelis (3/28/2011)


    I got it correct.

    I was surprised at first at the "SELECT @i+=1" syntax. I knew about the compount operators and have happily used "SET @i=1", but seeing never realised that it can equally well be used with SELECT.

    Thanks!

    I think setting variables with a SELECT statement like "SELECT @var1 = 1, @var2 =2" has always worked in SQL server.

    I have a pre SQL 92 SQL command refference with examples and it is listed there.

    It was also supported on MS SQL Server 7.