Creating Database on SQL server in VB6

greenspun.com : LUSENET : SQL Server Database Administration : One Thread

I have no problems connecting to my server and accessing the default database installed with SQL. I can even create a new database on my SQL server.

My problem is I want to check using VB6 code, if the database already exist on the SQL server. If it does just add tables to it and if it does not, create the database and then add tables to it.

You help will be greatly appreciated.

-- Anonymous, December 19, 1998

Answers

Theo,

Sorry for the delay getting back. I was on vacation.

You can check for the existence of a DB, for example MyDB, with the following SQL statement:

select * from master..sysdatabases where name = 'MyDB'

Hope this helps,

Eric

-- Anonymous, January 06, 1999


Here is a good link to answer your question in detail:

Monitoring SQL Queries
http://www.zdjournals.com/ivb/9808/ivb9881.htm

-- Anonymous, January 28, 1999


Moderation questions? read the FAQ