SQL Script and install DIR of my Db - Advanced Installer Community

We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

panda
Posts: 5
Joined: Fri Dec 05, 2008 12:13 pm

SQL Script and install DIR of my Db

Hi All

i have to make my installer with some sql script.
one of this make my db totally an have the install dir of data index and log.
The prob is that the paths is variable because the db was install on more machine.
i need to have a install.exe that ask me were i want to install db when run the master script.
Can i do with adv inst 6.7?

thx all and sorry for my ENG



Panda
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: SQL Script and install DIR of my Db

Hi Panda,

I'm not sure I understand what you need to do. Can you please give me more details? Are you installing a Database file or are you running a SQL Script which creates a Database?

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
panda
Posts: 5
Joined: Fri Dec 05, 2008 12:13 pm

Re: SQL Script and install DIR of my Db

my script install a database and inside my script there are the paths of my DB.
I have more machines and these paths are variable, so i need to make a ".exe" that ask me, during the installation ,where i want to install my DB.


example:


USE [master]
GO
/****** Object: Database [MRV] Script Date: 02/16/2008 12:20:49 ******/
IF NOT EXISTS (SELECT name FROM sys.databases WHERE name = N'MRV')
BEGIN
CREATE DATABASE [MRV] ON PRIMARY
( NAME = N'MRV', FILENAME = N'D:\DBMRV\Data\MRV_PRIMARY.mdf' , SIZE = 102400KB , MAXSIZE = UNLIMITED, FILEGROWTH = 51200KB ),
FILEGROUP [INDEX]
( NAME = N'MRV_index', FILENAME = N'D:\DBMRV\Index\MRV_index.ndf' , SIZE = 102400KB , MAXSIZE = UNLIMITED, FILEGROWTH = 51200KB )
LOG ON
( NAME = N'MRV_log', FILENAME = N'D:\DBMRV\Log\MRV_LOG.ldf' , SIZE = 51200KB , MAXSIZE = 2048GB , FILEGROWTH = 51200KB )
END
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: SQL Script and install DIR of my Db

Hi,

For this you can use the SQL Script Replacement feature. Here are the steps you can try:
- in the "Dialogs" page create a custom dialog which allows the user to enter the paths you need
- in the SQL script which contains the variable paths use a unique token for each path (for example "_path1_")
- after adding the script in Advanced Installer, use the SQL Script Replacement feature to replace the unique tokens in the script with the properties of the Path Edit controls on the custom dialog

For example, you can replace the "_path1_" token in the script with the property of a path edit control (which will be resolved to the path entered by the user). Let me know if you encounter problems with this approach.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
panda
Posts: 5
Joined: Fri Dec 05, 2008 12:13 pm

Re: SQL Script and install DIR of my Db

i try to work with your method but i have a problem to test my project.
my .exe also need to run some sql script (master script+other) and i can't test if it work if i didn't put some files in the project.
how can i solve this limit?


thx very much for support
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: SQL Script and install DIR of my Db

Hi,

Please note that you can add a dummy registry value in the Registry page. After that, in the Organization page you can set for the component of the registry value a condition which is always false (for example "1 = 2"). This way the value will not be created by the installation process.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
panda
Posts: 5
Joined: Fri Dec 05, 2008 12:13 pm

Re: SQL Script and install DIR of my Db

i click on RUN for test my project and i have this:

error.
Exception - Reason: Your project must contain at least one file before this operation can be performed.
Build finished because an error was encountered.
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: SQL Script and install DIR of my Db

Hi,

Did you create a registry value in the "Registry" page of your project? Please note that the project needs to contain at least one resource in order to be built (this is a Windows Installer requirement).

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
panda
Posts: 5
Joined: Fri Dec 05, 2008 12:13 pm

Re: SQL Script and install DIR of my Db

yes i create a reg value but i can't build my project.
I ins some file in app dir to workaround and now i can build mt project , but i have another error.
In the log i have this:

argumnents are: pathDB, BannerLine, to the right
MSI (c) (74:80) [16:44:42:187]: Note: 1: 2343
DEBUG: Error 2343: Specified path is empty.


pathDB is a dialog box...were i can check?
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: SQL Script and install DIR of my Db

Hi,

This error is shown because a path edit control on one of the installation dialogs does not have a value. Please note that in order to use a path edit control there are some steps you need to take. The User Guide contains the Browse for folder how-to which may help you.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”