The Tech Pursuit
The Dev Shelf
Pages
Home
Interview Questions
About Me
December 31, 2011
Check database exists or not in SQL
T-SQL
IF
EXISTS(
SELECT
*
FROM
sys.databases
WHERE
name
=
'DBName'
)
BEGIN
PRINT
'Database Exists.'
END
ELSE
BEGIN
PRINT
'Database does not exist.'
END
That’s It.
Enjoy Learning.
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment