Check if a Perticular Database exist or not

3:13 AM

This is simple sql query:
USE master
Go


IF EXISTS ( SELECT  name
            FROM    sys.databases
            WHERE   name = 'MyDataBase' ) 
    PRINT 'Exists'
ELSE 
    PRINT 'Does Not Exists'

0 comments:

Post a Comment