Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

Conditional statements in SQL Scripts execution


3 replies to this topic

Deli Radivoje

Deli Radivoje
  • Full Members
  • 7 posts

Posted 12 November 2009 - 16:43

I'm currently working on an instalation in which I need to connect to SQL server database. Because I have to support SQL server 2000, 2005 and 2008 I've been forced to create one script for SQL 2000 and another for SQL 2005 and 2008. Also, I've make a custom action which discover version of target SQL server (8, 9 , 10..) and put result to my property PSIT_SQL_VERSION. I've logged the installation and everything looks fine and the correct value was written in PSIT_SQL_VERSION.
My problem starts when I try to fire one SQL script only if I install on SQL 2000 server. I've wrote a condition statement
PSIT_SQL_VERSION=8
and script never executes. I've tried with different syntax like:
PSIT_SQL_VERSION="8"
PSIT_SQL_VERSION<<"8"
with same results.
I've also tried to move custom action that fills PSIT_SQL_VERSION to some other places in execution sequence (was before ISSQLServerInstall) but still no luck.
Does somebody know reason for this strange behaviour? I'm using InstallShield 2009 Professional.
Thanks in advance,
Misa

Edited by Deli Radivoje, 12 November 2009 - 16:45.


Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 12 November 2009 - 20:13

Does IT_SQL_VERSION get set before the CostFinalize action? As a test, set it on the command line to see if that works.

Deli Radivoje

Deli Radivoje
  • Full Members
  • 7 posts

Posted 13 November 2009 - 11:37

No, It wasn't smile.gif
I moved the custom action before CostFinalize and the setup started to work normally. I can only imagine that the conditional statement in SQL script is actually a condition of a component which encapsulate the script (which is hiden when you look at the Componenet window) and the conditional statement is evaluated on the beginning of the installation sequence, not at the time when script executes.
If it is the case, they just should mention that in a documentation mad.gif .
Thanks a lot.

Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 13 November 2009 - 15:56

Yes, you're right. And those conditions get evaluated during CostFinalize.