Logo 
Search:

Asp.net Answers

Ask Question   UnAnswered
Home » Forum » Asp.net       RSS Feeds
  Question Asked By: Rani Singh   on May 22 In Asp.net Category.

  
Question Answered By: Canan Kaya   on May 22

If you look in \FrameworkSDK\Samples\Setup you'll see an exe called configsetup ... it uses the sql files in the same dircetory to create  and install the database. Basically it uses dos to run  osql (main sqlserver program) ... a bit odd really that SQLServer is like 150% Windows orientated.
Though I think you could probably run .sql files from Enterprise Manager.

You could do it from a .bat file that would look similar to
@Echo Off

REM ***************************************************************************
REM ** File: CreateDatabase.cmd
REM ** Name: database  Setup
REM ** Desc: Database setup  batch file.
REM **
REM ** Date: 10/16/2001
REM **
REM **************************************************************************/

REM Use the following section to set the server  and sa password
REM of the SQL Server on which you want to create the database.
set SERVER=yourserver
set LOGIN=sa
set PWD=
set DBNAME=petshop3

@Echo.
@Echo *******************************************************************************
@Echo * Microsoft.NET PetShop Blueprint Application Database Setup *
@Echo * *
@Echo * *
@Echo * This script will create the .NET PetShop database and database objects. *
@Echo * If you wish to cancel, press [CTRL]-C and terminate the batch job. *
@Echo * *
@Echo *******************************************************************************
@Echo.
pause
@Echo.
@Echo.
@Echo *******************************************************************************
@Echo * Creating the Database... *
@Echo *******************************************************************************
@Echo.
osql -S %SERVER% -U %LOGIN% -P %PWD% -d master -i PetShop3_CreateDatabase.sql

@Echo.
@Echo.
@Echo *******************************************************************************
@Echo * Creating the Schema... *
@Echo *******************************************************************************
@Echo.
osql -S %SERVER% -U %LOGIN% -P %PWD% -d master -i PetShop3_Schema.sql

@Echo.
@Echo.
@Echo *******************************************************************************
@Echo * Inserting the Data... *
@Echo *******************************************************************************
@Echo.
osql -S %SERVER% -U %LOGIN% -P %PWD% -d %DBNAME% -i PetShop3_DataLoad.sql

@Echo.
@Echo *******************************************************************************
@Echo * *
@Echo * Script Complete *
@Echo * *
@Echo *******************************************************************************
@Echo.
pause

Share: 

 
 
Didn't find what you were looking for? Find more on Setup Related Question Or get search suggestion and latest updates.


Tagged: