This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Specify Database File Location
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Feb 21, 2011
04:03 PM
Specify Database File Location
I have look around and do not see an answer for this. I am using the database import wizard to create the db to be imported on my install. I need to be able to specify that the database .mdf and .ldf files be located in the same directory that my .dlls are being stored. How do I do that?
(3) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Feb 21, 2011
05:55 PM
Hi,
You will have to use the Text Replacement tab in the Sql Scripts view. You can refer a unique text in the sql script with the [INSTALLDIR] property.
I hope this helps.
Thanks!
You will have to use the Text Replacement tab in the Sql Scripts view. You can refer a unique text in the sql script with the [INSTALLDIR] property.
I hope this helps.
Thanks!
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Feb 21, 2011
10:33 PM
I am not sure I understand. In my InstallScript project I have a connection. In that connection I have the check box called "Create Catalog If Absent" checked.
I want it to create that database in my c:\Program Files\My Application\ directory not under the instance folder created by SQLServer: C:\Program Files\Microsoft SQL Server\MSSQL10_50.SQL2008\MSSQL\DATA
So you are saying if I do a find and replace on the [INSTALLDIR] that it will move the database? It seems like once we have gotten to the first script the database will have already been created.
I want it to create that database in my c:\Program Files\My Application\ directory not under the instance folder created by SQLServer: C:\Program Files\Microsoft SQL Server\MSSQL10_50.SQL2008\MSSQL\DATA
So you are saying if I do a find and replace on the [INSTALLDIR] that it will move the database? It seems like once we have gotten to the first script the database will have already been created.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Feb 22, 2011
12:15 PM
The first thing that you need to do is to uncheck the Create Catalog If Absent option, and then you need to add a SQL script that will create a database and schedule to run duing login. If you want to specify that the database .mdf and .ldf files be located in the [INSTALLDIR] directory, you need to add the Text Replacement entry below in the SQL Scripts view, and the SQL script would be like this:
Find What: %InstallDir%
Replace With: [INSTALLDIR]
Find What: %InstallDir%
Replace With: [INSTALLDIR]
CREATE DATABASE TestDb
ON
( NAME = TestDb_dat,
FILENAME = '%InstallDir%testdbat.mdf',
SIZE = 10,
MAXSIZE = 50,
FILEGROWTH = 5 )
LOG ON
( NAME = TestDb_log,
FILENAME = '%InstallDir%testdblog.ldf',
SIZE = 5MB,
MAXSIZE = 25MB,
FILEGROWTH = 5MB ) ;
GO
![](/skins/images/A5EADE085F77DE82FB3B14D6B307AE6A/responsive_peak/images/icon_anonymous_message.png)