Page 1 of 1

Retrieving main db name to execute 'Views' in server

Posted: Tue Aug 25, 2009 3:18 am
by serina
Hi there,

Currently I'm working on a db installation setup...so far everything is working on fine with my installation setup except one thing. The 'Create View' part in my SQL script is not being executed into my sql server even though there are so many 'views' in my script. There are actually 2 databases 'MainDB' and also 'HRMSDB' where all the 'views' are being created from these two databases as per in the script.

I've actually created a dialog to retrieve the 'MainDB' name and also 'HRMSDB' name from the user where it should replace these db names with the ones user have defined during the installation process. I've even set variables for these two 'MainDB' and 'HRMSDB' in the 'Writes Value To Variable' section.

Now, what I would like to know is how is it possible for both the db names to be referred with the names that user have defined during the installation process?? The db names where the 'views' are being created from need to be changed as well in the script in order for the 'views' to be executed in the sql server.

Hoping for a solution...

Thanks in advance.

Serina

Posted: Wed Aug 26, 2009 1:34 am
by neillans
If I am following what you are trying to do, you will need to store the view SQL in your MSI Code (or load it from a file), parse it to replace the db name, and then execute it.

Posted: Thu Sep 03, 2009 9:01 pm
by serina
Hi Andy,

The view SQL script is actually inside my db SQL script as well. Its not another separate script or what. Therefore, I'm using the same db name which suppose to be replaced in the SQL script with the db name that user have defined during the installation process. This db will eventually create the database in the SQL server whereby it should create the views as well in the same db. I've loaded this script using the MS SQL Server Script in MSIcode.

Well, hope you could get what I'm trying to enquire right now....

Thank you!

Serina