SQL script versioning

For all your non-technical questions.
ResonantWorks
Posts: 2
Joined: Wed Aug 15, 2007 1:23 pm

SQL script versioning

Postby ResonantWorks » Wed Aug 15, 2007 1:46 pm

Hi.

Does the latest InstallAware support sql script versioning as in InstallShield 2008?

To quote InstallShield's docs:

Specifying a Version Number for a SQL Script File
"...The installation checks the current schema version that is on the target database. The schema version is stored in the ISSchema column of the custom table named InstallShield. When you specify a schema version for a SQL script, the installation runs the script only if the script schema version number is greater than the current schema version number. Once the script is executed, the installation updates the current schema version on the target database to reflect the new schema version number"

CandiceJones
Posts: 904
Joined: Thu Dec 22, 2005 7:03 pm
Contact:

Postby CandiceJones » Thu Aug 16, 2007 4:19 am

Sure, this is just a few extra lines of SQL code that you can type into your SQL script.
Candice Jones
InstallAware
Home of The Next Generation MSI Installer
Get your free copy today - http://www.installaware.com/

ResonantWorks
Posts: 2
Joined: Wed Aug 15, 2007 1:23 pm

Postby ResonantWorks » Thu Aug 16, 2007 5:26 am

Can you give a simple example of how this would be done?
The only code I can think of right now is:

IF( SELECT CurrentVersion FROM VersionControl >= [UPDATE_VERSION] ) GOTO Finished
CREATE TABLE...
GO
INSERT ...
GO
INSERT ...
GO
UPDATE VersionControl SET CurrentVersion = [UPDATE_VERSION] )
GO
Finished:

But this would not work due to the GOs terminating the batch, causing the label "Finished" to be hidden from the rest.

neillans
Posts: 536
Joined: Sat Nov 04, 2006 6:21 am
Location: Scottish Borders, UK
Contact:

Postby neillans » Fri Aug 17, 2007 5:24 am

What I tend to do in these cases is use a stored procedure, and then pass the version + script to it :)

Or, try replacing the intermediate go's with semi colons.
Andy Neillans

greenstone
Posts: 29
Joined: Tue Oct 16, 2007 10:30 am

Postby greenstone » Tue Oct 16, 2007 10:35 am

Hi Neillans,

I have the same situation, but would prefer to keep my SQL script with the go's intact (your second suggestion).

I like your idea of using a stored procedure with the script and version. Could you post a sample of this stored procedure code and a sample script it uses? Is there any problem with the max-number-of-characters that a stored procedure parameter can handle?

Many thanks!


Return to “Non-Technical”

Who is online

Users browsing this forum: No registered users and 57 guests