How can I run a query to see if a database exists?
I see the queries like using the sysobjects and xtype to query
different table names and stored procs...but can I use something
similar to see if a database exists?
Something along the lines of: if exists(Select * from sysobjects where
xtype = 'database' Where database name = 'Client1DB')?IF DB_ID('foo') IS NULL
PRINT 'does not exist';
ELSE
PRINT 'exists';
"INeedADip" <ineedadip@.gmail.com> wrote in message
news:1151520416.422554.20030@.j72g2000cwa.googlegroups.com...
> How can I run a query to see if a database exists?
> I see the queries like using the sysobjects and xtype to query
> different table names and stored procs...but can I use something
> similar to see if a database exists?
> Something along the lines of: if exists(Select * from sysobjects where
> xtype = 'database' Where database name = 'Client1DB')?
>|||Thanks.
No comments:
Post a Comment