Results 1 to 7 of 7

Thread: Database Creation

  1. #1

    Thread Starter
    Member
    Join Date
    Jun 2000
    Posts
    39
    Is there any way to create a new database on an SQL Server (7.0) using ADO?

    Thanks in advance,

    Nahid Harjee

  2. #2
    Frenzied Member
    Join Date
    Aug 1999
    Location
    Santa Clara, Ca , 95058
    Posts
    1,105
    Sure, you can execute DML in a command object.

    After I posted this response, I re-read your question. My answer is for tables and other objects. SQL Server wasn't designed to create database objects on the fly, primarily because you're required to have a license to run it and because there are parameters, for performance, storage and security, that need to be set/maintained. Perhaps you can explain why you think you need to create a database on the fly?



    [Edited by JHausmann on 06-19-2000 at 04:28 PM]

  3. #3

    Thread Starter
    Member
    Join Date
    Jun 2000
    Posts
    39

    Databases on the fly

    Thanks a lot for the response.

    The reason I need to create a database on the fly is because I want to make a simple VB app. that can create a database and all the tables in it, without me having to go into SQL Server Enterprise Manager and specifying all the field types, etc., etc.

    In other words, I'm trying to make several databases (named differently, of course) all following the same template.

    Nahid Harjee

  4. #4
    New Member
    Join Date
    Jun 2000
    Location
    NY
    Posts
    2

    Lightbulb

    Hi,

    well JHausmann was right. I dont think theres a way of creating an SQL Server database on the fly using (ADO), there are too many things that have to be done using SQL Server alone. Like storage and security (Grants and Revokes). You can use ADO to connect to the database using the proper DSN of course and use ADO's objects to interact with the database.
    G.

  5. #5
    Frenzied Member
    Join Date
    Aug 1999
    Location
    Santa Clara, Ca , 95058
    Posts
    1,105
    You can create your tables on the fly but you'll need to fix the number of databases. I'm still not clear why you need all the different databases and tables. From what you've posted thus far, I would create one database with as many tables as you need. In those tables that require it, I'd have a userid. Your code would use the userid to ensure that a user (company, whatever) would only access the data that pertains to them.

    I'd use different databases for a test region, a validation region and a production region (but only if you can't get a server for each environment).

  6. #6

    Thread Starter
    Member
    Join Date
    Jun 2000
    Posts
    39
    Yup, that's exactly the reason for all the databases. I need one for testing, one for doing a demo for my supervisors and one which will be the final production database.

  7. #7
    Frenzied Member
    Join Date
    Aug 1999
    Location
    Santa Clara, Ca , 95058
    Posts
    1,105
    You can either build a script that builds your structure or you can use the tools provided to copy the structures.

    Where I work, we've created a set of scripts that create everything. If we want a new database, we just run the scripts...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width