Archive: Problems with SQL Server Express in installation


Problems with SQL Server Express in installation
Hi all:
Im new in all this and i dont know how can i do this.
im trying to install SQL Server and restore a database with problems.
First of all i install the version 2.0 of Compact Framework:

SetOverwrite on
SetOutPath "$INSTDIR"
File "dotnetfx.exe"
ExecWait '$INSTDIR\dotnetfx.exe /Q /C:"install.exe /noaspupgrade /q"'

Then i install the SQL Server Express:

File "SQLEXPR_ESN.EXE"
ExecWait '$INSTDIR\SQLEXPR.EXE /qb ADDLOCAL=ALL INSTANCENAME=MSSQLSERVER SECURITYMODE=SQL SAPWD=onix SQLAUTOSTART=1 DISABLENETWORKPROTOCOLS=0'

And after this i try to restore the database:

nsExec::Exec osql -E -Q "RESTORE FILELISTONLY FROM DISK = '$INSTDIR\BD.bak'"
nsExec::Exec osql -E -Q "restore database BD from disk='$INSTDIR\BD.bak' WITH NORECOVERY, MOVE 'BD' TO 'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\BD.MDF', MOVE 'BD_Log' TO 'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\BD_Log.LDF'"

I think that im installing the first two things OK but it doesnt restore the database.
Can you help me please????


Try to reading here first and if doesn't help I'm sure here are people that know more :)


Sorry about it :(
There few people help and i thought that here maybe someone could help me.


Are you sure that sql express installs OSQL? the new command line interface is sqlcmd.
You can also try to use the MSSQL plugin. You find it at the plugins page on official nsis site.


Hi sgiusto:
Im trying the MSSQL plugin but i cant get it working. This is the code im using.
Do you know what im doing bad?

MSSQL_OLEDB::SQL_Logon /NOUNLOAD ""(local)\MSSQLSERVER" "sa" "onix"
MSSQL_OLEDB::SQL_Execute /NOUNLOAD "RESTORE FILELISTONLY FROM DISK = '$INSTDIR\BD.bak'"
MSSQL_OLEDB::SQL_Execute /NOUNLOAD "restore database BD from disk='$INSTDIR\BD.bak' WITH NORECOVERY, MOVE 'BD' TO 'C:\Archivos de programa\Microsoft SQL Server\MSSQL.1\MSSQL\Data\BD.mdf', MOVE 'BD_Log' TO 'C:\Archivos de programa\Microsoft SQL Server\MSSQL.1\MSSQL\Data\BD_Log.ldf'"
MSSQL_OLEDB::SQL_Logout


MSSQL_OLEDB::SQL_Logon /NOUNLOAD ""(local)\MSSQLSERVER" "sa" "onix"

You have an additional quote at the begining


I had this same problem. Part of the problem is that the path environment is not set for the system to find osql (or sqlcmd for that matter) until after your installer closes.

I spent well over a full day trying to figure this out. Eventually, I found that if I called the osql using the full path, the command ran as expected. I think that sqlcmd is faster than osql but both work.

Try something like this
<code>
ExecWait '$TEMP\SQLEXPR.EXE /qb sapwd=password disablenetworkprotocols=0 securitymode=SQL INSTANCENAME=MSSQLSERVER ADDLOCAL=SQL_Engine'
ExecWait '"$PROGRAMFILES\Microsoft SQL Server\90\Tools\Binn\osql" -U sa -P password -i "$PATHTO\mysqlfile.sql"'
</code>


Hi chivalri:
Ive tried the code you said and when it says :
"Didnt found the stored procedure TAPE"
And dont do anything.

Can you help me please?


This is the code ive used:

ExecWait '"$PROGRAMFILES\Microsoft SQL Server\90\Tools\Binn\osql" -U sa -P onix -i "$INSTDIR\BD.sql"'


Where is the .exe?

Stu


Which .exe Afrow UK ?


You are trying to execute "osql" without the .exe.
Yes this would work in command prompt, but not here.

Stu


Dear trust11 & Everybody,

I'm stuck with the same issue. After installing Sql Express from NSIS, I want to run sqlcmd from nsis script so that I can make the login password for user 'sa' blank. But I'm unable to execute that and the reasons are unknown to me but must be in the same lines as discussed in this thread.

Can anyone please let me know the exact command to be given in NSIS Script to run sqlcmd ( from $PROGRAMFILES\Microsoft SQL Server\90\Tools\Binn\SQLCMD.EXE) to alter the password for the user sa. The sql query file (AlterLoginPswd.sql):
ALTER LOGIN sa WITH PASSWORD= '',CHECK_EXPIRATION=OFF,CHECK_POLICY=OFF

Regards,


[ps.:Its a little bit urgent, bear with me please]


[ps.:Its a little bit urgent, bear with me please] [/B]

Here, here!! Its sad because there isn't a solid example out there..

Hi All,

I too am in an really bad position, marketing jumped the gun and now mgt are going to kick my arse if I cant write an installer before advertisements come out.. ! arrhhhh!

To test the installation, I am using a program called MojoPac.com on a external HDD, instead of VMware so I'm not sure if thats the root cause.


Problem
============
Run the following script, it doesn't install WindowsInstaller3.1, or .Net2.0 or SQLExpress.

Here is the log it produces:
Windows Version Analysis
Windows Version Determined
Windows Permission Analysis
Windows Permission Determined
Windows Installer Analysis
Windows Installer complete
.Net Analysis
SQL Server Analysis
Checking for existing SQL Server Instance
SQL Server Analysis Completed


Cause
===========
Maybe because MojoPac uses the host OS??? I cant install on my local PC cos I have SQL Ent edition, Win 3.1 and .Net 2 already installed.

Resolution
===========
I'm in process of getting VM ware setup on a scsi disk.

Please help me guys, thanks in advance, its heaps urgent! :) :) :)



Here are the references I found to make this script

http://nsis.sourceforge.net/NSISLog_plug-in

http://www.johnsadventures.com/archi..._and_nsis.html

http://nsis.sourceforge.net/Installi....NET_Framework

http://msdn2.microsoft.com/en-us/library/ms144259.aspx

http://blogs.msdn.com/sanchan/archiv...28/609097.aspx

http://forums.winamp.com/showthread....run+sql+script

HEre's the script


!include WinVer.nsh
!include x64.nsh

XPStyle on

;funky little splash fade in effect!
Function .onInit
# the plugins dir is automatically deleted when the installer exits
InitPluginsDir
File /oname=$PLUGINSDIR\splash.bmp "c:\myprog\logo.bmp"

#optional
#File /oname=$PLUGINSDIR\splash.wav "C:\myprog\sound.wav"

;MessageBox MB_OK "Fading"

advsplash::show 4000 600 400 -1 $PLUGINSDIR\splash

Pop $0 ; $0 has '1' if the user closed the splash screen early,
; '0' if everything closed normal, and '-1' if some error occured.
Delete $PLUGINSDIR\csplash.bmp
FunctionEnd



; HM NIS Edit Wizard helper defines
!define PRODUCT_NAME "REPLACE_WITH_APP_NAME"
!define PRODUCT_VERSION "3.0"
!define PRODUCT_PUBLISHER "REPLACE_WITH_APP_NAME"
!define PRODUCT_WEB_SITE "http://www.REPLACE_WITH_YOUR_WEBSITE.com"
!define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\REPLACE_WITH_APP_NAME CE.exe"
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
!define PRODUCT_UNINST_ROOT_KEY "HKLM"

; MUI 1.67 compatible ------
!include "MUI.nsh"

; MUI Settings
!define MUI_ABORTWARNING
!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\modern-install.ico"
!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico"

!define BRANDINGTEXT "REPLACE_WITH_APP_NAME Pty Ltd"

; Welcome page
!insertmacro MUI_PAGE_WELCOME
; License page
!define MUI_LICENSEPAGE_RADIOBUTTONS
!insertmacro MUI_PAGE_LICENSE "..\License.rtf"
; Directory page
!insertmacro MUI_PAGE_DIRECTORY
; Instfiles page
!insertmacro MUI_PAGE_INSTFILES
; Finish page
!define MUI_FINISHPAGE_RUN "$INSTDIR\REPLACE_WITH_APP_NAME.exe"
!insertmacro MUI_PAGE_FINISH

; Uninstaller pages
!insertmacro MUI_UNPAGE_INSTFILES

; Language files
!insertmacro MUI_LANGUAGE "English"


; MUI end ------





;==================================

!macro CHECK_MIN_WIN_VER
var /GLOBAL WIN_VER_PASSED ;Win98?
var /GLOBAL WIN_SERVICEPACK_PASSED ;Win2kSP3
var /GLOBAL SQL_SERVICEPACK_PASSED ;Win2kSP4,Win2k3SP1,WinXPSP2
StrCpy $WIN_VER_PASSED “1?
StrCpy $WIN_SERVICEPACK_PASSED “1?
StrCpy $SQL_SERVICEPACK_PASSED “1?

ReadRegDWORD $R0 HKLM "System\CurrentControlSet\Control\Windows" "CSDVersion"
IntOp $R0 $R0 / 256 ;get service pack major version

nsislog::log "$INSTDIR\install.log" "Windows Version Analysis"

${If} ${IsWin2000}
${If} $R0 < “3? ; SP3
StrCpy $WIN_SERVICEPACK_PASSED “0?
${ElseIf} $R0 < “4? ; SP4
StrCpy $SQL_SERVICEPACK_PASSED “0?
${EndIf}
${ElseIf} ${IsWin2003}
${If} $R0 < “1? ; SP1
StrCpy $SQL_SERVICEPACK_PASSED “0?
${EndIf}
${ElseIf} ${IsWinXP}
${If} $R0 < “2? ; SP2
StrCpy $SQL_SERVICEPACK_PASSED “0?
${EndIf}
${ElseIf} ${AtMostWin2000}
StrCpy $WIN_VER_PASSED “0?
${EndIf}

nsislog::log "$INSTDIR\install.log" "Windows Version Determined"

!macroend


;==================================




!macro CHECK_ADMIN_RIGHTS

nsislog::log "$INSTDIR\install.log" "Windows Permission Analysis"

var /GLOBAL USER_ADMIN_PASSED ;Administrator
StrCpy $USER_ADMIN_PASSED “1?
userInfo::getAccountType
pop $0
${If} $0 != “Admin”
StrCpy $USER_ADMIN_PASSED “0?
${EndIf}

nsislog::log "$INSTDIR\install.log" "Windows Permission Determined"
!macroend

!macro MSI_INSTALL installer_path

nsislog::log "$INSTDIR\install.log" "Windows Installer Analysis"
;install msi version 3
GetDllVersion “$SYSDIR\msi.dll” $1 $2
IntOp $3 $1 / 0×00010000
IntOp $4 $1 & 0×0000FFFF
;IntOp $5 $2 / 0×00010000
;IntOp $6 $2 & 0×0000FFFF
StrCpy $0 ‘$3.$4'
IntCmp $0 “3.1? MSI_NO_INSTALL MSI_INSTALL
MSI_INSTALL: ;may be 3.0 or 3.1
SetDetailsPrint both
DetailPrint "Updating Windows Installer"
SetDetailsPrint none

ExecWait "${installer_path}\WindowsInstaller-KB893803-v2-x86.exe /quiet /norestart"

Sleep 2000 ; wait for a 2 seconds
;!insertmacro EXEC_SUBINSTALLER “Windows Installer 3.1? \
;‘”${installer_path}\WindowsInstaller-KB893803-v2-x86.exe” /quiet /norestart’
MSI_NO_INSTALL:

nsislog::log "$INSTDIR\install.log" "Windows Installer complete"

!macroend


;==================================




!macro NET_INSTALL installer_path

nsislog::log "$INSTDIR\install.log" ".Net Analysis"

;Check for framework 2.0————————————–
StrCpy $1 “0?
ReadRegDword $1 HKLM "SOFTWARE\Microsoft\NET Framework Setup\NDP\v2.0.50727" "Install"
;MessageBox MB_OK $1
${If} $1 == “”
${If} ${RunningX64}


StrCpy $9 '"${installer_path}\netfx64.exe" /q /c:"install.exe /qb /noaspupgrade"'
${Else}
StrCpy $9 '"${installer_path}\dotnetfx2.0.exe" /q /c:"install.exe /qb /noaspupgrade"'
${EndIf}

SetDetailsPrint both
DetailPrint "Installing .Net Framework"
nsislog::log "$INSTDIR\install.log" "Installing .Net 2.0"

SetDetailsPrint none
;!insertmacro EXEC_SUBINSTALLER “Microsoft .Net Framework 2.0? $9
ExecWait $9

nsislog::log "$INSTDIR\install.log" "Installation of .Net 2.0 complete"

${EndIf}


!macroend




;==================================





!macro IS_SQL_INSTALLED instance_name
;original version returned a 1..
;!macro IS_SQL_INSTALLED instance_name ;return
nsislog::log "$INSTDIR\install.log" "SQL Server Analysis"

;original version returned a 1 or 0..
;strcpy ${return} “0?

StrCpy $0 “0?

ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Microsoft SQL Server\${instance_name}\MSSQLServer\CurrentVersion\" "CurrentVersion"
${If} $0 != “” ;should = 9.if 2005 8. if 2000

!insertmacro SQL_INSTALL $INSTDIR "REPLACE_WITH_APP_NAME" "passw0rd" "$PROGRAMFILES\Microsoft SQL Server"

nsExec::ExecToLog '"$INSTDIR\CreateDatabase.cmd" "REPLACE_WITH_APP_NAME" "REPLACE_WITH_APP_NAME" "$INSTDIR\CreateDatabase.sql"'

;strcpy ${return} “1?
${EndIf}
!macroend


;==================================




!macro SQL_INSTALL installer_path instance_name password install_dir

nsislog::log "$INSTDIR\install.log" "Checking for existing SQL Server Instance"

;Check for existing instance
AddSize 358400
ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Microsoft SQL Server\${instance_name}\MSSQLServer\CurrentVersion\" "CurrentVersion"
${If} $0 == “” ;should = 9.if 2005 8. if 2000
;!insertmacro EXEC_SUBINSTALLER “Microsoft SQL Server 2005 Express Edition” \
;‘”${installer_path}\SQLEXPR.exe” /settings ${settings_file} -q /norebootchk /qb reboot=ReallySuppress addlocal=all INSTANCENAME=${instance_name} SAPWD=${password} INSTALLSQLDIR=”${install_dir} SCCCHECKLEVEL=IncompatibleComponents:1;MDAC25Version:0”‘

nsislog::log "$INSTDIR\install.log" "Installing SQL Server"

${If} ${IsWin2000}
ExecWait "${installer_path}\SQLEXPR.exe -q /norebootchk /qn reboot=ReallySuppress addlocal=all INSTANCENAME=${instance_name} SAPWD=${password} INSTALLSQLDIR=${install_dir} SQLBROWSERACCOUNT=NT AUTHORITY\SYSTEM SQLACCOUNT=NT AUTHORITY\SYSTEM AGTACCOUNT=NT AUTHORITY\SYSTEM ASACCOUNT=NT AUTHORITY\SYSTEM RSACCOUNT=NT AUTHORITY\SYSTEM SQLBROWSERAUTOSTART=1 SQLAUTOSTART=1 AGTAUTOSTART=1 ASAUTOSTART=0 RSAUTOSTART=0 SECURITYMODE=SQL DISABLENETWORKPROTOCOLS=0 ERRORREPORTING=1 SQMREPORTING=0 ENABLERANU=0 ADDUSERASADMIN=0"
${Else}
ExecWait "${installer_path}\SQLEXPR.exe -q /norebootchk /qn reboot=ReallySuppress addlocal=all INSTANCENAME=${instance_name} SAPWD=${password} INSTALLSQLDIR=${install_dir} SQLBROWSERACCOUNT=NT AUTHORITY\NETWORK SERVICE SQLACCOUNT=NT AUTHORITY\NETWORK SERVICE AGTACCOUNT=NT AUTHORITY\NETWORK SERVICE ASACCOUNT=NT AUTHORITY\NETWORK SERVICE RSACCOUNT=NT AUTHORITY\NETWORK SERVICE SQLBROWSERAUTOSTART=1 SQLAUTOSTART=1 AGTAUTOSTART=1 ASAUTOSTART=0 RSAUTOSTART=0 SECURITYMODE=SQL DISABLENETWORKPROTOCOLS=0 ERRORREPORTING=1 SQMREPORTING=0 ENABLERANU=0 ADDUSERASADMIN=0"

;troubleshooting change qn to qb
;ExecWait "${installer_path}\SQLEXPR.exe -q /norebootchk /qb reboot=ReallySuppress addlocal=all INSTANCENAME=${instance_name} SAPWD=${password} INSTALLSQLDIR=${install_dir} SQLBROWSERACCOUNT=NT AUTHORITY\NETWORK SERVICE SQLACCOUNT=NT AUTHORITY\NETWORK SERVICE AGTACCOUNT=NT AUTHORITY\NETWORK SERVICE ASACCOUNT=NT AUTHORITY\NETWORK SERVICE RSACCOUNT=NT AUTHORITY\NETWORK SERVICE SQLBROWSERAUTOSTART=1 SQLAUTOSTART=1 AGTAUTOSTART=1 ASAUTOSTART=0 RSAUTOSTART=0 SECURITYMODE=SQL DISABLENETWORKPROTOCOLS=0 ERRORREPORTING=1 SQMREPORTING=0 ENABLERANU=0 ADDUSERASADMIN=0"

${EndIf}

;ExecWait 'net start mssql$$$REPLACE_WITH_APP_NAME'
Sleep 10000 ; wait for a 10 seconds
${EndIf}


nsislog::log "$INSTDIR\install.log" "SQL Server Analysis Completed"

!macroend



;==================================


Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
OutFile "Setup.exe"
InstallDir "$PROGRAMFILES\REPLACE_WITH_APP_NAME"
InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
ShowInstDetails show
ShowUnInstDetails show

Section "MainSection" SEC01
SetOutPath "$INSTDIR"
SetOverwrite ifnewer
File "..\REPLACE_WITH_APP_NAME CE.exe"
CreateDirectory "$SMPROGRAMS\REPLACE_WITH_APP_NAME"
CreateShortCut "$SMPROGRAMS\REPLACE_WITH_APP_NAME\REPLACE_WITH_APP_NAME.lnk" "$INSTDIR\REPLACE_WITH_APP_NAME.exe"
CreateShortCut "$DESKTOP\REPLACE_WITH_APP_NAME.lnk" "$INSTDIR\REPLACE_WITH_APP_NAME.exe"
File "..\CSHttpClient.dll"
File "..\m4usms.dll"
File "..\TimeSync.exe"



;add the windows installer, .net 2.0, sql express exe's to the InstallDirectory

;The 64 or 32 bit switch
File "..\Components\dotnetfx2.0.exe"
;File "..\Components\netfx64.exe"
File "..\Components\WindowsInstaller-KB893803-v2-x86.exe"
File "..\Components\SQLEXPR.exe"
File "..\Components\CreateDatabase.cmd"
File "..\Components\CreateDatabase.sql"


!insertmacro CHECK_MIN_WIN_VER

!insertmacro CHECK_ADMIN_RIGHTS

!insertmacro MSI_INSTALL $INSTDIR

!insertmacro NET_INSTALL $INSTDIR

!insertmacro IS_SQL_INSTALLED "REPLACE_WITH_APP_NAME"

Delete "$INSTDIR\dotnetfx2.0.exe"
;File "..\Components\netfx64.exe"
Delete "$INSTDIR\WindowsInstaller-KB893803-v2-x86.exe"
Delete "$INSTDIR\SQLEXPR.exe"
Delete "$INSTDIR\CreateDatabase.cmd"
Delete "$INSTDIR\CreateDatabase.sql"

SectionEnd


Section -AdditionalIcons
WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}"
CreateShortCut "$SMPROGRAMS\REPLACE_WITH_APP_NAME\Website.lnk" "$INSTDIR\${PRODUCT_NAME}.url"
CreateShortCut "$SMPROGRAMS\REPLACE_WITH_APP_NAME\Uninstall.lnk" "$INSTDIR\uninst.exe"
SectionEnd

Section -Post
WriteUninstaller "$INSTDIR\uninst.exe"
WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\REPLACE_WITH_APP_NAME CE.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\REPLACE_WITH_APP_NAME CE.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"
SectionEnd


Function un.onUninstSuccess
HideWindow
MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) was successfully removed from your computer."
FunctionEnd

Function un.onInit
MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Are you sure you want to completely remove $(^Name) and all of its components?" IDYES +2
Abort
FunctionEnd

Section Uninstall
Delete "$INSTDIR\${PRODUCT_NAME}.url"
Delete "$INSTDIR\uninst.exe"
Delete "$INSTDIR\TimeSync.exe"

Delete "$INSTDIR\REPLACE_WITH_APP_NAME.exe"

RMDir "$INSTDIR\Styles"

RMDir "$SMPROGRAMS\REPLACE_WITH_APP_NAME"
RMDir "$INSTDIR"

DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"
SetAutoClose true
SectionEnd

Dear meaningoflights, thanks a lot for your source code.
I've somehow overcome the issue of installation of sql express 2005. But there are lot of things to learn from your code. Please just confirm that the code you've pasted here is running without a single error. Right now I'm into a different project will definitely have a go with your coding in near future.

Thanks once again...
Regards,
Swapan


Unattended WinInstaller, SQL, .Net NSIS installtion script
G'day Swapan,

I can confirm it runs without a single error, I had to do the following fixes:


This line:
IntCmp $0 “3.1? MSI_NO_INSTALL MSI_INSTALL MSI_NO_INSTALL

This line:
;StrCpy $1 “0?
;ReadRegDword $1 HKLM "SOFTWARE\Microsoft\NET Framework Setup\NDP\v2.0.50727? "Install"
;${If} $1 != “1?

;${registry::Read} "HKEY_LOCAL_MACHINE\Software\Microsoft\NET Framework Setup\NDP\v2.0.50727" "SP" $R0 $R1
;${If} $R1 == ""

ReadRegStr $R1 HKLM "SOFTWARE\Microsoft\NET Framework Setup\NDP\v2.0.50727" "Install"
${If} $R1 == ""




This line (in two places):
;ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Microsoft SQL Server\${instance_name}\MSSQLServer\CurrentVersion\" "CurrentVersion"
;${If} $0 != “9” ;should = 9.if 2005 8. if 2000

;${registry::Read} "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\${instance_name}\MSSQLServer\CurrentVersion" "CurrentVersion" $R0 $R1
;${If} $R1 == ""

ReadRegStr $R1 HKLM "SOFTWARE\Microsoft\Microsoft SQL Server\${instance_name}\MSSQLServer\CurrentVersion" "CurrentVersion"
${If} $R1 == ""



To use the cmd and sql files refer to this post:
http://forums.winamp.com/showthread.php?threadid=275340&highlight=run+sql+script

Tip: Make sure the SQL Instance name is shorter than 16 chars.

For the complete script, the original one I found posted by Scott Moore here:
http://www.JeremyThompson.Net/Rocks/Unattended WinInstaller, SQL, .Net NSIS installtion script.txt

http://www.JeremyThompson.Net


Re: Unattended WinInstaller, SQL, .Net NSIS installtion script
Quote:


G'day mate,

Your instance name is shorter than 16 chars (dont add the PC name too), as per the requirements set out in BOL:


Named instance
Choose this option to create a new named instance. Bear in mind the following when naming an instance of SQL Server:

Instance names are not case sensitive.

Instance names cannot contain the terms "Default," "MSSQLServer," or other reserved keywords. If a reserved keyword is used in an instance name, a Setup error will occur.

**Instance names are limited to 16 characters.


JEzza
I'm still testing, finally setup VM ware with Win2000,XP and Vista, hurraaaay



Originally posted by meaningoflights

Tip: Make sure the SQL Instance name is shorter than 16 chars.
Thanks for the detailed & prompt reply. Right now I'm creating my own instance name in this format:

[computer name]\[my instance name]

e.g: SERVER\SWAPANLABSSE

(where SERVER=computer name; SWAPANLABSSE=the instance name I want to create in user's system]

"SWAPANLABSSE" is already 12 chars.+ computer name will definitely cross 16 chars., but this is working and use install SSE and with this instance name. Please clarify on this issue of instance name's max.length.

Regards,
Swapan