SQL Server/T-SQL/Database/databases
Query is_auto_close_on FROM sys.databases
1> USE master
2> GO
Changed database context to "master".
1>
2> SELECT name, is_auto_close_on FROM sys.databases
3> GO
name is_auto_close_on
----------------------------------------------------------- ----------------
master 0
tempdb 0
model 0
msdb 0
MyDb 1
(5 rows affected)
1>
2>
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