View Single Post
Old 30th October 2018, 13:57   #1
benjasperson
Junior Member
 
Join Date: Oct 2018
Posts: 7
Building SQL Databse

I'm trying to use SQLCMD in an installer to build a local database. At one point, I was at least able to display the SQL errors, and after removing only (as far as I can remember) unrelated lines of code, I can't even see the errors. I know SQLCMD is still doing something because the output.txt file is being created. It's just blank. There are obviously errors because (and of course, this is the main issue) the database is not being created.

code:
OutFile "db_installer.exe"
!include psexec.nsh
!include LogicLib.nsh

Section

InitPluginsDir
SetOutPath $PLUGINSDIR
File /r SQLCMD
ExecWait '"$PLUGINSDIR\SQLCMD\sqlcmd.exe" -S Cmp-000000\SQLEXPRESS -i createdbonfile.sql -o output.txt'
FileOpen $4 "$PLUGINSDIR\SQLCMD\output.txt" r
FileSeek $4 0
ClearErrors
${DoUntil} ${Errors}
FileRead $4 $1
DetailPrint $1
${LoopUntil} 1 = 0
FileClose $4

# default section end
SectionEnd



I don't think I'm missing any necessary SQLCMD files because I can build the database when just run SQLCMD from command line.

Thanks in advance for the help.
benjasperson is offline   Reply With Quote