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

Installing database Files

I'd like to have a user be allowed to install the MDF and LDF files for a database to a destination other than the TARGETDIR. I have a create script and a custom dialog that asks for the location of that directory but I can't figure out how to put the directory into the create script.

Can i assign a property into the text replacement tab or is there a function I need to call to make this work?
Labels (1)
0 Kudos
(7) Replies
hidenori
Level 17

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

It's an install script project
0 Kudos
hidenori
Level 17

Here is a sample SQL script and a text replacement entry that will create a database using a database file installed to a script-defined folder.

CREATE DATABASE TestDB
ON
( NAME = TestDb_dat,
FILENAME = %MyDatabaseDir%\testdbdat.mdf',
SIZE = 10,
MAXSIZE = 50,
FILEGROWTH = 5 )
GO


Find What: %MyDatabaseDir%
Replace With:

Hope this helps.
0 Kudos
kemmererm
Level 3

hidenori wrote:

Find What: %MyDatabaseDir%
Replace With:


Where do I define NEW_DIRECTORY1 for that to work, and how do I access it form the Installscript?
0 Kudos
hidenori
Level 17

A script-defined folder can be created using the Browse for Directory dialog that can be launched from the Destination property grid in the Components view. You can call the FeatureSetTarget() function to assign a target location to the folder that you create.
0 Kudos
kemmererm
Level 3

Thanks that solved my problem nicely. What does the first argument of the FeatureSetTarget function mean though? I'm using MEDIA and it works but I'd like to know why.
0 Kudos
hidenori
Level 17

With InstallScript, the special value MEDIA used as the first argument to feature functions just refers to the file-based InstallScript .cab files. Using a value other than MEDIA indicates a script-created media set with fake features created with FeatureAddItem and FeatureSetData.

The InstallScript help topics "MEDIA" and "Script-Created Feature Set vs. File Media Library" give a little more information.
0 Kudos