views:

376

answers:

1

I'm creating an install package using InnoSetup and installing SQL Server 2005 Express. Here's the code below that appears in my RUN section:

Filename: "{app}\SQL Server 2005 Express\SQLEXPR.exe" ; Parameters: "-q /norebootchk /qn reboot=ReallySuppress addlocal=all INSTANCENAME=(LOCAL) SCCCHECKLEVEL=IncompatibleComponents:1;MDAC25Version:0 ERRORREPORTING=2 SQLAUTOSTART=1 SAPWD=passwordhere SECURITYMODE=SQL"; WorkingDir: {app}\SQL Server 2005 Express; StatusMsg: Installing Microsoft SQL Server 2005 Express... Please Wait...;Check:SQLVerifyInstall

What I'm trying to accomplish is have the SQL Server package install but only have the instance name itself reference the name of the machine name and nothing more. What I'm receiving instead is a named instance instead of local such as MachineName\SQLEXPRESS which is not what I want to receive.

I need a local instance instead of a named instance due to the way my code is written to be able to install and talk with the databases in question. I would change it, trust me, were it not the fact that this install package is a replacement to a previous package that used the MSDE installer. I have to be able to support both through code. Any suggestions are welcome but a clear and concise method to get the installer to quietly install using only the machine name is my main goal. Thanks for the help and support!

+1  A: 

Here's a sample for setting the InstanceName in code:

    ; Script generated by the Inno Setup Script Wizard.
    ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

    [setup]
    ; NOTE: The value of AppId uniquely identifies this application.
    ; Do not use the same AppId value in installers for other applications.
    ; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
    AppId={{4D044938-6185-4729-8EB9-33CFA5D51993}
    AppName=My Program
    AppVerName=My Program 1.5
    AppPublisher=My Company, Inc.
    AppPublisherURL=http://www.example.com/
    AppSupportURL=http://www.example.com/
    AppUpdatesURL=http://www.example.com/
    DefaultDirName={pf}\My Program
    DefaultGroupName=My Program
    OutputBaseFilename = setup
    Compression = lzma
    SolidCompression = yes

    [Languages]
    Name: "english"; MessagesFile: "compiler:Default.isl"

    [Tasks]
    Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked

    [Files]
    Source: "SQLEXPR.exe"; DestDir: "{app}"; Flags: ignoreversion
    ; NOTE: Don't use "Flags: ignoreversion" on any shared system files

    [Run]
    Filename: "{app}\SQLEXPR.exe" ; Parameters: "INSTANCENAME={code:MyInstanceName|'SQLEXPRESS'}";


    [Code]
    function MyInstanceName(Param: String): String;
    begin
      //This sets the value to \MSSQLSERVER.
      Result := ExpandConstant('{computername}') + '\MSSQLSERVER';
    end;

However, from what I've seen on the net the instance name should be MSSQLSERVER if you want it to be the default instance on the machine.

mirtheil
I'll give this a try and report back with result. Thanks for the info.
Jeff
Actually this code doesn't do anything different to keep an instance name from entering but instead defines it by your code block. What I'm looking for the possibility of having only the Machine Name as the SQL Server name at the end of the day. If I walk through the GUI installer this is possible. But reproducing those results from running a quiet install from the command line seems to be an issue.
Jeff
Where you're code did not result in a true fix for my question the method for polling the computer name and adding the instance name did correct an issue I encountered later. I believe the final answer to this is that it is not possible to accomplish. Thanks for your assistance!
Jeff