Problems creating an MSSQL database when using filespec

For all your non-technical questions.
Darren
Posts: 13
Joined: Fri Aug 15, 2008 3:35 pm

Problems creating an MSSQL database when using filespec

Postby Darren » Mon Aug 18, 2008 5:12 pm

Hi all,

I am evaluating Studio version and have a most of my install working. The big problem I have now is creating a database. I have incorporated the SQL sample project and its instance detection successfully. It validates that I am connecting to the database. When I use the exact same setup for the MS SQL Server plug-in and add a simple database creation script, it says it is successful but never creates the database. I am outputing in a Messagebox the return variable as well as all the other variables involved in the create script. They all have the right values.

Code: Select all

create database [$SQLDBNAME$] on primary
(name = N'$SQLDBNAME$_Data, filename = N'$SQLDATAFOLDER$\\$SQLDBNAME$_Data.MDF', size = 5MB, maxsize = unlimited, filegrowth = 10%),
filegroup [INDEX]
(name = N'$SQLDBNAME$_Index', filename = N'$SQLDATAFOLDER$\\$SQLDBNAME$_Index_Data.NDF', size = 5MB, maxsize = unlimited, filegrowth = 10%)
log on
(name = N'$SQLDBNAME$_Log', filename = N'$SQLDATAFOLDER$\\$SQLDBNAME$_Log.LDF, size = 5MB, maxsize = 1GB, filegrowth = 10%)
collate SQL_Latin1_General_CP1_CI_AS
go


If I just use "GO" and check the "Create database if absent" box then it creates the database. If I don't check the "Create database if absent" box and do nothing more than:

Code: Select all

create database [$SQLDBNAME$]


It works. Is there a bug? Is there a different way to accomplish this? We have an enterprise app that will require the flexibility to define a different location for SQL dB data files. IT groups frequently have non-default locations for these files.

I'm stuck. Any ideas? Any help?

Darren
Posts: 13
Joined: Fri Aug 15, 2008 3:35 pm

Postby Darren » Tue Aug 19, 2008 9:25 am

Never mind :lol: I sorted it out. It came down to the script file not being saved properly as ANSI text. So for anyone else, if you are running SQL scripts from SQL Server plug-in, use Message Box to output the return variable. If you are getting "SUCCESS" from the result but the script isn't doing anything, then odds are good that your script file is not properly ANSI text. Open it up in notepad and do a "Save As" and make sure you choose "ANSI".

I've never had to be particular about saving a file as ANSI vs Unicode so it took me a while to figure out that my script was still saved as Unicode.

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

Postby CandiceJones » Tue Aug 19, 2008 11:04 am

Ah great to hear that! Yes all scripts must be ANSI.
Candice Jones
InstallAware
Home of The Next Generation MSI Installer
Get your free copy today - http://www.installaware.com/


Return to “Non-Technical”

Who is online

Users browsing this forum: No registered users and 25 guests