database programmaticaly created

  • i had to create in ASP net very huge databases with many tables , key, contraints , stored procedures (the sql creation text file is 200kO), how to create such database programmaticaly, when i try to create a stored procedure in the master database, i got this error create or alter should be the first query in a stored procedure and of course i have at least fivety such 'create or alter' query in my script!! i have a template of the database to create.

    i create the databe using: create database @basename in asp.net but how to fill the new database with all my tables and contraints and stored procedures

  • In your script file, you need to have batch terminator "GO". You can have only one "create/alter procedure" etc in one batch

    Then in your asp code, read one batch a time and submit it to SQL server.

     

  • i found the answer, i reorganize the create database script manually, so tables are created before key, contraints and procedures. when the script is running fine , i save it in a sql text file under sqlserver management studio, after i read the file string and put it in my sqltext command and execute a huge query.

    after i copy some setup data in the tables using sqlbulkcopy as explain in msdn.

    There is no go command in my sql only

    if not exist(blabla..)

    begin

    end

    thanks for your help

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply