May 15, 2007 at 3:22 pm
Hello,
I want to find out active databases in SQL Server with one sql query
select name from sysdatabases where status ....
This query should return only active databases but not the databases which are undergoing restore,offline etc..I mean i should get the database names which are available to users to use.
Thanks
May 15, 2007 at 4:07 pm
Read about sysdatabases system table in BOL.
Everything is there.
_____________
Code for TallyGenerator
May 15, 2007 at 4:14 pm
sp_helpdb returns database name and status. Look for Status=ONLINE.
Greg
Greg
May 15, 2007 at 5:53 pm
select *
from master.dbo.sysdatabases
where DATABASEPROPERTYEX(name, 'Status') = 'OnLine'
_____________
Code for TallyGenerator
May 16, 2007 at 10:30 am
Thanks sergiy...
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply