Using system table: databases
1> DECLARE @DBName nvarchar(128) 2> DECLARE @TBLName nvarchar(128) 3> SET @DBName = N'Northwind' 4> SET @TBLName = N'Shippers' 5> 6> SELECT name 7> FROM sys.databases 8> WHERE name = @DBName 9> GO