Thursday, July 20, 2006

InstallAware and SQL Scripts

So the other day I had a problem with an install I was building using InstallAware. The install had been working fine, but suddenly it stopped applying one of my SQL scripts properly.

The symptom was quite weird. The SQL script function in the install created the database, and didn't return an error (in fact, it returned SUCCESS), but my script clearly wasn't being run. The script was supposed to create several pieces of schema in the new database, and none of this schema existed after the install.

I spent hours checking the SQL script, the install script, changing various things, adding debug message boxes, and re-building/running the install. All to no avail. In the end I broke through the network security on our test system and attach SQL profiler (running on my development PC) to the test PC. I watched the statements executed during the install and I noticed something weird - instead of running my script it, the install was executing an 'exec' command followed by some high-ASCII characters.

I checked my script file again by opening it in notepad, and it appeared fine. At this point I was suspicious anyway, so I re-saved the script and explicitly selected ANSI as the encoding. The file size for the script was cut in half, and after I rebuilt and tested the install it worked fine.

The moral of the story ? If you're using InstallAware be careful NOT to save your SQL scripts in Unicode format. It seems InstallAware can't deal with Unicode.

Another thing to be aware of, the evaluation version of InstallAware I downloaded recently has a bug in it where variable replacement isn't performed on SQL scripts loaded from files (rather than embedding the script in the install itself). I'm not sure if the evalulation download has been updated since or not, but InstallAware do have a patch available for this, so check their support forums for a link to the download.

No comments:

Post a comment