Solved

How to: Install SQL Server 2005 Express with INNO setup

Posted on 2008-11-02
4
9,589 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
  • 2
  • 2
4 Comments
 
LVL 26

Accepted Solution

by:
tigin44 earned 500 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

Free Webinar: AWS Backup & DR

Join our upcoming webinar with experts from AWS, CloudBerry Lab, and the Town of Edgartown IT to discuss best practices for simplifying online backup management and cutting costs.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to install windows?? 2 60
When to install VMware Tools on Domain Controller? 9 118
SOC, SIEM, IPS and FW 4 52
Why isn't my network passing a certain vlan. 24 46
In SQL Server, when rows are selected from a table, does it retrieve data in the order in which it is inserted?  Many believe this is the case. Let us try to examine for ourselves with an example. To get started, use the following script, wh…
In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

733 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