Skip to content
Fix Code Error

Get list of databases from SQL Server

March 13, 2021 by Code Error
Posted By: sef

How can I get the list of available databases on a SQL Server instance? I’m planning to make a list of them in a combo box in VB.NET.

Solution

Execute:

SELECT name FROM master.sys.databases

This the preferred approach now, rather than dbo.sysdatabases, which has been deprecated for some time.


Execute this query:

SELECT name FROM master.dbo.sysdatabases

or if you prefer

EXEC sp_databases
Answered By: Ben Hoffstein

Related Articles

  • 'block in draw' rails 6 routes
  • exclude items based on field value
  • What's the difference between eval, exec, and compile?
  • Jetpack Compose and Hilt Conflict
  • Execution failed for task…
  • An Authentication object was not found in the…
  • How to sum up the value inside the loop?
  • Gradle error: Execution failed for task…
  • org.gradle.api.tasks.TaskExecutionException:…
  • SQL Server: Query fast, but slow from procedure
  • Android- Error:Execution failed for task…
  • Generate SQL Create Scripts for existing tables with Query
  • Is it possible to have multiple joins between two…
  • How to find column names for all tables in all…
  • SQL query return data from multiple tables
  • Conditional WHERE clauses with TVP parameter
  • Set value to vaadin combobox(polymer)
  • collision detection from picturebox in a list c#
  • When I'm testing a web app by JUnit and Mockito I…
  • vaadin-combo-box / vaadin-combo-box-overlay change…
  • Navbar not filling width of page when reduced to mobile view
  • Tag/group data inside dataset according to next row
  • How do I obtain a Query Execution Plan in SQL Server?
  • How do I switch two players in tic-tac-toe game in Python?
  • How to call Stored Procedure in a View?
  • How can I get column names from a table in SQL Server?
  • How to get distinct count of records from table…
  • How can I require at least one checkbox be checked…
  • Polymer, vaadin-combo-box; Get value of input
  • How to create a temporary table in SSIS control flow…
  • SQL Server query to find all permissions/access for…
  • What are the uses of the exec command in shell scripts?
  • Drop all the tables, stored procedures, triggers,…
  • What do 'real', 'user' and 'sys' mean in the output…
  • Start redis-server with config file
  • CSS Input with width: 100% goes outside parent's bound
  • C# WinForms ComboBox: AutoComplete does not sort descending
  • Vaadin combobox value-changed not working
  • problem with client server unix domain stream…
  • python 3.2 UnicodeEncodeError: 'charmap' codec can't…
  • Select SQL Server database size
  • How to manage nested arrays in Vuex Store and pass…
  • How do I find the data directory for a SQL Server instance?
  • Gradle: Execution failed for task ':processDebugManifest'
  • T-SQL: Export to new Excel file
  • sys.argv[1] meaning in script
  • Why does find -exec mv {} ./target/ + not work?
  • python capture sys.stdout and sys.exit produced by…
  • How to create a drop shadow only on one side of an element?
  • How should I deal with "package '✘✘✘' is not…
  • Maximum value for long integer
  • DROP Constraint without knowing the name
  • How to override style of vaadin element?
  • Passing DataTable to Table-Valued Parameter in…
  • Error:Execution failed for task…
  • How to find all serial devices (ttyS, ttyUSB, ..) on…
  • How to turn off ALL conventions in Entity Framework Core 5
  • python and sys.argv
  • T-SQL How to create tables dynamically in stored procedures?
  • How do I check what version of Python is running my script?
  • Procedure or function !!! has too many arguments specified
  • Mean per group in a data.frame
  • SQL Server, How to set auto increment after creating…
  • PHP - count specific array values
  • How to convert java.util.Date to java.sql.Date?
  • ConstraintLayout - center and constraint
  • Ember 2, filter relationship models (hasMany,…
  • Text size and different android screen sizes
  • SSH Private Key Permissions using Git GUI or…
  • Insert text into Text file with T-SQL
  • How to obtain the start time and end time of a day?
  • SQL Server stored procedure Nullable parameter
  • Determine if Python is running inside virtualenv
  • SecurityException: Permission denied (missing…
  • What's the difference between Instant and LocalDateTime?
  • Trouble with boxes appearing/hiding based on selection
  • Why is Ember throwing "Uncaught Error: Assertion…
  • Liveness Probe through C# code giving error
  • T-SQL: Can I query one view for values and then…
  • Add unique constraint to combination of two columns
  • Python sys.argv lists and indexes
  • How to run python script with elevated privilege on windows
  • Create a view with ORDER BY clause
  • How to query for Xml values and attributes from…
  • Differences between fork and exec
  • Database development mistakes made by application developers
  • How to find out what is locking my tables?
  • How to dynamically add and remove views with Ember.js
  • Listing information about all database files in SQL Server
  • Use SQL Server Management Studio to connect remotely…
  • Does moment.js allow me to derive a timezone…
  • How do I get the path of the current executed file…
  • Angular 2 Polymer Vaadin combo-box set value programatically
  • Manually raising (throwing) an exception in Python
  • How do I execute a MS SQL Server stored procedure in…
  • List of Timezone IDs for use with FindTimeZoneById() in C#?
  • Convert python script to airflow dag
  • Executing T-SQL query from table
  • TLS 1.3 server socket with Java 11 and self-signed…
  • List of all index & index columns in SQL Server DB

Disclaimer: This content is shared under creative common license cc-by-sa 3.0. It is generated from StackExchange Website Network.

Post navigation

Previous Post:

Table fixed header and scrollable body

Next Post:

JavaScript isset() equivalent

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

.net ajax android angular arrays aurelia backbone.js bash c++ css dataframe ember-data ember.js excel git html ios java javascript jquery json laravel linux list mysql next.js node.js pandas php polymer polymer-1.0 python python-3.x r reactjs regex sql sql-server string svelte typescript vue-component vue.js vuejs2 vuetify.js

  • you shouldn’t need to use z-index
  • No column in target database, but getting “The schema update is terminating because data loss might occur”
  • Angular – expected call-signature: ‘changePassword’ to have a typedeftslint(typedef)
  • trying to implement NativeAdFactory imports deprecated method by default in flutter java project
  • What should I use to get an attribute out of my foreign table in Laravel?
© 2022 Fix Code Error