• Just be careful. There are certain circumstances where Set RowCount is ignored. Also, the RowCount will stay set within your procedure until the procedure either ends or you turnit off (Set ROWCOUNT = 0 turns it off).

    If not used carefully, Set RowCount can cause you a lot of problems, and you won't realize it until it's too late.

    Personally, I would advocate building the query dynamically and using Exec() or sp_executesql to execute it.


    My blog: SQL Soldier[/url]
    SQL Server Best Practices:
    SQL Server Best Practices
    Twitter: @SQLSoldier
    My book: Pro SQL Server 2008 Mirroring[/url]
    Microsoft Certified Master: SQL Server, Data Platform MVP
    Database Engineer at BlueMountain Capital Management[/url]