Wednesday, March 7, 2012

list of Databases

hello anybody now

i need to find how many Databases in my local SQL server (programatically).i know i have 8 databases is there but i need to print each and every database.

can anybody help me.

thanx

kiran.

try the command...

sp_databases

look into master > stored procedures > sp_databases
and customize it|||

Thanxs

its working rom-rom

|||kiran, glad i've been of help, thanks|||

The problem with sp_databases is that it displays the system databases, together with Northwind and Pubs. I use this to identify my databases:

USE master
GO
SELECT name FROM sysdatabases WHERE dbid>6

|||select * from information_schema.schemata is a polically correct version of the previous post

No comments:

Post a Comment