cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
FunkOff
Level 2

InstallShield SQL Script Execution Order

Hi Peoples, I am currently having trouble with executing an SQL Script through my Installer Application. If i run the script through SQL Server it executes fine. The problem is that when the script runs to create views it validate the view on fly. This causes me issues when the view has sub views and these views are not created before the header view (so the installer thinks the sub view does not exist) and it errors. The only fix is to go through the script and make sure that the sequence of view creation is all set so sub views are done before their parent views. This is a painstaking process as there is hundreds of views.

Has anyone come across this problem and got any fixes?

Thanks
Labels (1)
0 Kudos
(3) Replies
hidenori
Level 17

What project type are you using? If you are using a pure InstallScript project, you must turn on the Batch Mode from the root level shortcut menu of the SQL Scripts view to execute SQL scripts in the order as displayed in the view.
0 Kudos
FunkOff
Level 2

Hi hidenori, Thanks for the reply. This doesnt seem to have fixed the problem. I am not using an InstallScript project, i am using a Basic MSI project. I did try doing it through an InstallScript project though but still had the same problem. I will better explain the problem.

I am creating a basic install to install a database up to the users server. I used the database import wizard to create the script from our database. The problem is when we have Views which have sub views which are out of order.

e.g. vwMainview has 2 subviews called vwSubView1 and vwSubView2

If the sql script puts the orders out of whack like the following:

***************
'CREATE VWSUBVIEW1

'CREATE VWMAINVIEW

'CREATE VWSUBVIEW2
***************

This will cause an error to occur stating that the vwSubView2 cannot be found while creating vwMainView.

Other than going through the script and reordering all the views so that the subViews are always created before their parent views (this would be ugly since there are hundreds of views), I cannot think of a fix. Setting the batch mode didnt seem to fix this problem.

Is there any other way?

Thanks
0 Kudos
hidenori
Level 17

Thank you for the clarification. I tried it with a very simple views which have some dependencies, but the database import wizard generated a script in a correct order. Would it be possible for you to provide a sample database (with a disk backup file) that reproduces the behavior so that I can look into the issue?

Thank you for your patience and cooperation.
0 Kudos