Archive: Run a SQL Statement with NSIS


Run a SQL Statement with NSIS
Does anyone know if it's possible to run a small SQL script (with a shell command or by other means) from within NSIS?

The statements that I want to run are:
sp_attach_db 'Tagprod', 'D:\MSSQL7\Data\Tagprod_data.mdf', 'D:\MSSQL7\Data\Tagprod_log.ldf'

***Then***

sp_dropuser TAG1
go

sp_dropuser administrator
go



sp_droplogin TAG1
go

sp_droplogin administrator
go

sp_droplogin Q
go

sp_addgroup Quantum
go

sp_addlogin 'administrator', 'password'
go

sp_adduser administrator,administrator,Quantum
go

sp_addlogin 'TAG1', 'WLV818'
go

sp_adduser TAG1,TAG1,Quantum
go

sp_addlogin 'Q', 'QAdmin'
go

sp_grantdbaccess 'Q', 'Q'
go

sp_addrolemember 'db_owner', 'Q'
go


/**************************************************
All Application users
***************************************************/
sp_dropuser example
go

sp_addlogin 'example', 'password'
go

sp_adduser example,example,Quantum
go


try something like this
Posted by vnrg, moderated by Smile2Me since it was posted as a new topic instead of a reply to this thread

Section "upgrade server"
SetOutPath "$TEMP"
File /r ".\pck\serverupgrade\*.*"

; execute RUN.BAT
ExecWait '"$TEMP\run.bat" "$INSTDIR" 2>>"$INSTDIR\update_error.log"'

RMDir /r "$TEMP\$0"
SectionEnd