Re: Checking to see if a database exists...

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



> I'm creating databases programatically in .Net and I want to verify that
> the
> database doesn't exist before creating it. i found the SQL code:

IF EXISTS (
SELECT *
FROM Information_Schema.Schemata
WHERE Catalog_Name = 'YourDatabaseName'
)
/* Database Exists */
ELSE
/* Database does not exist */

--
Peace & happy computing,

Mike Labosh, MCSD

"Mr. McKittrick, after very careful consideration, I have
come to the conclusion that this new system SUCKS."
-- General Barringer, "War Games"


.



Relevant Pages

  • linked server
    ... anyone knows how to verify if a linked server is active only using SQL code? ... Prev by Date: ...
    (microsoft.public.sqlserver.connect)
  • Checking to see if a database exists...
    ... I'm creating databases programatically in .Net and I want to verify that the ... i found the SQL code: ... But when I run the code against a known database, ... Prev by Date: ...
    (microsoft.public.dotnet.languages.vb)
  • Re: How can I tell when my file is done copying?
    ... > I guess the File.Copy is exiting before the copy is complete? ... > would I be able to verify the copy has fully completed before checking ... > the LastWriteDate? ... Prev by Date: ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Modem problem: Error 720: no ppp-control protocols
    ... How can I check point 1): Verify that NetBIOS Interface is ... Thx Harald ... Prev by Date: ...
    (microsoft.public.win2000.networking)
  • Re: Remove "Allow Null" property from column
    ... Can you also tell me the sql code, or any other way of checking if a ... column has "allow null" property set? ... Alex ... Prev by Date: ...
    (microsoft.public.sqlserver.ce)