?
Solved

How to: Install SQL Server 2005 Express with INNO setup

Posted on 2008-11-02
4
Medium Priority
?
9,745 Views
Last Modified: 2012-05-05
Hi,

How can I install SQL Server 2005 Express with INNO setup. Does anybody done this and can explain it to me? The things that I would like to accomplish are:

Check if (an older version of) SQL Server is already installed (or when the user wants to install another instance of it)
- install SQL Server 2005 Express unattended with parameters
Installation will only be done on Windows XP, Vista and Windows Server 2003.

I would appreciate a description as detailed as possible, so I know how to set thing up correctly. Maybe somebody is willing to share a INNO Setup projectfile where this is done.
0
Comment
Question by:Delphiwizard
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 26

Accepted Solution

by:
tigin44 earned 2000 total points
ID: 22861187
hi DelphiWizard
an Inno script like below can help you

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

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

[Setup]
AppName=EgtMrk2007
AppVerName=Eitim Merkezleri Veri Giri_ Uygulamas1 V.1.0
AppPublisher=K.K.Personel Ba_kanl11 YBS ^. Md.lüü
AppPublisherURL=https://perybs.kkk.tsk
AppSupportURL=https://perybs.kkk.tsk
AppUpdatesURL=https://perybs.kkk.tsk
DefaultDirName=c:\EgtMrk2007
DefaultGroupName=EgtMrk2007
AllowNoIcons=yes
Compression=lzma
SolidCompression=yes

[Code]

const
  SQLDMOGrowth_MB = 0;
var
  SqlKurma:Boolean;

procedure SQLDMOButtonOnClick(SDir,DDir:String);
var
  SQLServer, Database, DBFile, LogFile: Variant;
  SQLServerName:string;
  i,j:integer;
  egtmrkC:boolean;
begin
  if SQLKurma=True then exit;

  egtmrkC:=False;
      {Named instance SQLSERVER}
  SQLServerName:=GetComputerNameString+'\SQLSERVER';
   { Create the main SQLDMO COM Automation object }
   try
    SQLServer := CreateOleObject('SQLDMO.SQLServer');
  except
    RaiseException('Please install Microsoft SQL server connectivity tools first.'#13#13'(Error ''' + GetExceptionMessage + ''' occurred)');
  end;
   { Connect to the Microsoft SQL Server }
  SQLServer.LoginSecure := True;
  try
    SQLServer.Connect(SQLServerName);
  except
    RaiseException('SQL Server is not installled or the service is not started.'#13#13'(Error ''' + GetExceptionMessage + ''' occurred)');
    exit;
  end;
 
  { Setup AnyDataBase }
  Database := CreateOleObject('SQLDMO.Database');
  Database.Name := 'AnyDataBase';

  DBFile := CreateOleObject('SQLDMO.DBFile');
  DBFile.Name := 'AnyDataBase_Data';
  DBFile.PhysicalName :=DDir+'\AnyDataBase.mdf';
  DBFile.PrimaryFile := True;
  DBFile.FileGrowthType := SQLDMOGrowth_MB;
  DBFile.FileGrowth := 1;

  Database.FileGroups.Item('PRIMARY').DBFiles.Add(DBFile);

  LogFile := CreateOleObject('SQLDMO.LogFile');
  LogFile.Name := 'AnyDataBase_Log';
  LogFile.PhysicalName :=DDir+'\AnyDataBase.ldf';

  Database.TransactionLog.LogFiles.Add(LogFile);
end;

Function SQLKur:Boolean;
begin
  if ((msgBox ('Do you want to install SQL Server?',mbinformation,mb_YesNo)=idYes)) then
   Result:=True
 else
  begin
    Result:=False;
    SQLKurma:=True;
  end;
end;

Function SQLKontrol:Boolean;
Var
 PortNum:string;
begin
 if ((RegValueExists(HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\Microsoft SQL Server\AnyDataBase\SETUP','SQLPath')) or (SQLKur=False)) then //Exists or do not install
   Result:=False
 else Result:=True;
end;

[Tasks]

[Files]
Source: "c:\SQL Server 2005 Express\*" ; DestDir: "{app}\SQL Server 2005 Express"; Flags: onlyifdoesntexist

; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[Run]
Filename: "{app}\SQL Server 2005 Express\setup.exe" ; Parameters: "SECURITYMODE=SQL  DISABLENETWORKPROTOCOLS=0 SAPWD=""AnyPassword"" instancename=""SQLSERVER"""; WorkingDir: {app}\SQL Server 2005 Express; StatusMsg: SQL Server Setup;Check:SQLKontrol

[Icons]

[Run]
0
 

Author Comment

by:Delphiwizard
ID: 22862117
Thank you for the script.
Can this script be integrated into the script that I use to install my own application?
0
 
LVL 26

Expert Comment

by:tigin44
ID: 22863568
sure you can integrate tat scipt with yours... Actually I pulled it out from one of my application set up scripts.
0
 

Author Closing Comment

by:Delphiwizard
ID: 31512462
Thank you very much!
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

With User Account Control (UAC) enabled in Windows 7, one needs to open an elevated Command Prompt in order to run scripts under administrative privileges. Although the elevated Command Prompt accomplishes the task, the question How to run as script…
Create a Windows 10 custom Image with custom task bar and custom start menu using XML for deployment.
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question