Solved

How to: Install SQL Server 2005 Express with INNO setup

Posted on 2008-11-02
4
9,660 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 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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

So every once in a while at work I am asked to export data from one table and insert it into another on a different server.  I hate doing this.  There's so many different tables and data types.  Some column data needs quoted and some doesn't.  What …
Create a Windows 10 custom Image with custom task bar and custom start menu using XML for deployment.
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

726 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