Getting Started with Adobe After Effects - Part 6: Motion Blur


Upload Image Close it
Select File

A place to share commonly used scripts for SQL Server Database Administrators.

Moderators

SQL Server DBA Scripts

Identify system and user databases programatically

Jul 11 2012 12:00AM by Nakul Vachhrajani   

How do you identify system and user databases programatically? How do you hide the "master" database from the user when running an installer? Use these scripts to either list system or user databases as requried.

--*********************************************************
--WARNING:
--These queries are provided "as-is" and without warranty
--The author, BeyondRelational.com and Microsoft are not
--responsible for damage caused by misuse of this query
--*********************************************************

--Provides a list of system databases
SELECT sdb.database_id,
       sdb.name
FROM sys.databases sdb 
WHERE CAST((CASE WHEN SUBSTRING(sdb.name,0,14) IN ('master','msdb','model','tempdb','ReportServer$') 
                      THEN 1 
                 ELSE sdb.is_distributor 
            END) AS BIT) = 1

--Provides a list of user databases
select sdb.database_id,
       sdb.name
from sys.databases sdb 
WHERE CAST((CASE WHEN SUBSTRING(sdb.name,0,14) IN ('master','msdb','model','tempdb','ReportServer$') 
                      THEN 1 
                 ELSE sdb.is_distributor 
            END) AS BIT) = 0


Nakul Vachhrajani
4 · 33% · 10575
2
 
1
 
0
Failed
 
0
Lifesaver
 
 
0
Unwise



Submit

Your Comment


Sign Up or Login to post a comment.

"Identify system and user databases programatically" rated 5 out of 5 by 2 readers
Identify system and user databases programatically , 5.0 out of 5 based on 2 ratings
    Copyright © Rivera Informatic Private Ltd Contact us      Privacy Policy      Terms of use      Report Abuse      Advertising      [ZULU1097]