January 21, 2010 at 4:54 am
HI,
Please send T-Sql query to find total number of database present in the server.
Ex: No.of Database :50
Thanks in advance
January 21, 2010 at 5:06 am
SELECT COUNT(name) FROM sys.databases
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
This thing is addressing problems that dont exist. Its solution-ism at its worst. We are dumbing down machines that are inherently superior. - Gilfoyle
January 21, 2010 at 5:28 am
another (not so efficient) method:
SELECT top 1 database_id as DB_COUNT
FROM sys.databases
order by database_id DESC
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
This thing is addressing problems that dont exist. Its solution-ism at its worst. We are dumbing down machines that are inherently superior. - Gilfoyle
January 21, 2010 at 6:10 am
Hi,
Select count (*) from sys.databases
Thanks,
Nagesh
January 21, 2010 at 9:40 pm
Thank you very much for your replies but it is not working in sql 2000
pls provide solution to work all the versions of sql
Thanks in advance
January 21, 2010 at 9:55 pm
In 2000 simply use
Select count (*) from sysdatabases --without the . between sys and databases
and not
Select count (*) from sys.databases
Next time dont put sql 2000 questions under the 2008 section.
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
This thing is addressing problems that dont exist. Its solution-ism at its worst. We are dumbing down machines that are inherently superior. - Gilfoyle
January 21, 2010 at 9:55 pm
Hi,
You’re in the 2008 Forums, but you need for 2000!!!
Select count (*) from sys.databases -- above 2000 version
select count (*) from master..sysdatabases -- in 2000
January 21, 2010 at 10:26 pm
sivark1 (1/21/2010)
Thank you very much for your replies but it is not working in sql 2000
Hmm, this IS a SQL 2008 forum that you posted in.....;-)
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply