cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
pedrer
Level 3

Create DataBase Script SQL

Hello,

I have a problem with de procedure to create one D.B on SQL...for example in my project define one data base path, and in this script....

CREATE DATABASE [AURALL50] ON (NAME = N'AURALL50', FILENAME = N'C:\Archivos de programa\Microsoft SQL Server\MSSQL$SERVIDOR\Data\AURALL50.mdf' , SIZE = 4, FILEGROWTH = 10%) LOG ON (NAME = N'AURALL50_log', FILENAME = N'C:\Archivos de programa\Microsoft SQL Server\MSSQL$SERVIDOR\Data\AURALL50_log.LDF' , FILEGROWTH = 10%)
COLLATE Modern_Spanish_CI_AI

i need define on runtime the path to the database directory...create before.

Thank's and sorry for my bad english.

Pedrer
Labels (1)
0 Kudos
(5) Replies
hidenori
Level 17

What project type are you using?
0 Kudos
pedrer
Level 3

I'm use the MSI Basic ...thank's

pedrer
0 Kudos
hidenori
Level 17

You need to use the SQL Script's Text Replacement functionality in order to accomplish your requirements.

1. Add the following Text Replacement entry for your script in the SQL Scripts view:

Find What: %DatabaseDataDir%
Replace With: [MYDBDATADIR]

2. Change your script as follows:
[Code]CREATE DATABASE [AURALL50] ON (NAME = N'AURALL50', FILENAME = N'%DatabaseDataDir%\AURALL50.mdf' , SIZE = 4, FILEGROWTH = 10%) LOG ON (NAME = N'AURALL50_log', FILENAME = %DatabaseDataDir%\AURALL50_log.LDF' , FILEGROWTH = 10%)
COLLATE Modern_Spanish_CI_AI[/Code]

MYDBDATADIR is a custom Windows Installer property or Directory identifier that you need to specify.

Hope this helps.
0 Kudos
pedrer
Level 3

Thank's so much...but on my install, i dont now who make that appear's the data base folder dialog.

pedrer
0 Kudos
hidenori
Level 17

Please refer to the help topic "Creating Installations > Defining the End-User Interface > Working with Dialogs in Basic MSI Projects > Displaying Dialogs During Basic MSI Installations". You may need to repeat the process for the Back button on the subsequent dialog box.
0 Kudos