Tuesday, February 3, 2009

To get the database names from the Sql Server

Execute below query on "master" Database.

select [name] as [Database] from sysdatabases order by [name]

It gives all the Database names in the given server.

Connection string for c# code is :
"Data Source=localhost; Initial Catalog=master; uid=myID pwd=myPassword;"

No comments:

Post a Comment