Setting rowcount also limits the available databases in the database drop down...

  • All,

    When setting the rowcount in a query in SQL Server Management Studio, the count of databases in the database drop down in SSMS also shrinks to the number in the "SET ROWCOUNT" statement.

    For example:

    SET ROWCOUNT 0 - Shows all databases

    SET ROWCOUNT 2 - Shows ONLY the top 2 database on the server

    It also seems that the setting this in the "Tools/Options/Query Execution" has the same behavior.

    Is this the desired behavior since the drop down is using the same session as the query or just a bug in SSMS?

    Anton

  • Interesting.

    SSMS is probably internally running a query / stored proc to get the list of databases. Obviously the "SET ROWCOUNT" is affecting the code it uses as well.

    I guess technically that is a bug. Presumably their code could store whatever value you had for SET ROWCOUNT, reset it to 0, run their query, then reset it back to your value.

    SQL DBA,SQL Server MVP(07, 08, 09) A socialist is someone who will give you the shirt off *someone else's* back.

  • I just ran Profiler to see what was happening and as I suspected the operation to get the list of databases is happening on the same SPID as the query window you are in meaning it is also subject to the ROWCOUNT setting. It kind of makes sense to use the same SPID else every query window would actually open two connections to the instance, but this is an odd side-effect.

    There are no special teachers of virtue, because virtue is taught by the whole community.
    --Plato

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply