Available Databases Dropdown in SSMS<\/figcaption><\/figure>\nThis dropdown behaves weird when you change the connection properties.<\/p>\n
Observation 1:<\/strong>
\nRun the below query in the query window<\/em>
\n[sql]
\nSET PARSEONLY ON
\n[\/sql]<\/p>\nNow when you try to expand the dropdown, the drop down does not expand.<\/strong><\/p>\nRun the below query to turn off PARSEONLY <\/em>
\n[sql]
\nSET PARSEONLY OFF
\n[\/sql]<\/p>\nObservation 2:<\/strong><\/p>\nRun the below query in the query window<\/em>
\n[sql]
\nSET ROWCOUNT 2
\n[\/sql]<\/p>\nNow if you try to click on the dropdown, you will find only 2 available databases.<\/strong><\/p>\nRun the below query to reset ROWCOUNT to 0<\/em>
\n[sql]
\nSET ROWCOUNT 0
\n[\/sql]<\/p>\nWhy is the dropdown behaving this way?<\/strong>
\nSSMS is using the same connection used by the query to fetch the Available databases list.<\/em>
\nSSMS runs the below command to fetch the results for the Availabale Databases DropDown, using the same connection used by the Query.
\n[sql]
\nSELECT dtb.name AS [Name], dtb.state AS [State] FROM master.sys.databases dtb
\n[\/sql]<\/p>\nAlso, You would also get wrong results count into the @@ROWCOUNT, when you run the query and accidentally touch the availabale databases dropdown.<\/em><\/p>\nObservation 3:<\/strong>
\nRun the below query
\n[sql]
\nSELECT * FROM SYS.OBJECTS
\nSELECT @@ROWCOUNT as ROWSCOUNT
\n[\/sql]
\nMake a note of the ROWSCOUNT Result.<\/p>\nNow run the query
\n[sql]
\nSELECT * FROM SYS.OBJECTS
\n[\/sql]<\/p>\n
Click on the available databases dropdown and run the below query.<\/p>\n
[sql]
\nSELECT @@ROWCOUNT as ROWSCOUNT
\n[\/sql]<\/p>\n
You can identify the difference in the values of @@ROWCOUNT.<\/p>\n
The first result would be the number of objects in the database.
\nThe second result would be the number of databases in the Server.<\/p>\n","protected":false},"excerpt":{"rendered":"
SQL Server Management Studio (SSMS) Has a available databases dropdown ( to select a database to execute the query.). This dropdown behaves weird when you change the connection properties. Observation 1: Run the below query in the query window [sql] SET PARSEONLY ON [\/sql] Now when you try to expand the dropdown, the drop down…<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[186,3],"tags":[],"class_list":["post-258","post","type-post","status-publish","format-standard","hentry","category-sql-server-issues","category-sqlserverpedia-syndication"],"_links":{"self":[{"href":"https:\/\/sqlserverlearner.com\/wp-json\/wp\/v2\/posts\/258","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sqlserverlearner.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sqlserverlearner.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sqlserverlearner.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sqlserverlearner.com\/wp-json\/wp\/v2\/comments?post=258"}],"version-history":[{"count":0,"href":"https:\/\/sqlserverlearner.com\/wp-json\/wp\/v2\/posts\/258\/revisions"}],"wp:attachment":[{"href":"https:\/\/sqlserverlearner.com\/wp-json\/wp\/v2\/media?parent=258"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sqlserverlearner.com\/wp-json\/wp\/v2\/categories?post=258"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sqlserverlearner.com\/wp-json\/wp\/v2\/tags?post=258"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}