You must be logged in to reply to this topic.
I am trying to write a script to call SQL using osql.
This is the call I'm building . . .
Environment.Item("NmsDwSqlScript") = -S %COMPUTERNAME% -Q "exec NmsDw.dbo.spProcFileLogIns @FileName='" & Environment.Item('INVOICEFILE") & "', @FileSize='" & Environment.Item("NmsDw_FileSize") & "', @FileDate='" & Environment.Item("NmsDw_FileTms") & "', @TableName='NmsInvoiceDw'" & "'"
The resulting contents of "NmsDwSqlScript" look like . . .
NmsDwSqlScript-S LINSQL02 -Q 'exec NmsDw.dbo.spProcFileLogIns @FileName='INV.TXT', @FileSize='44335694', @FileDate='6/30/2010 7:47:11 AM', @TableName='NmsInvoiceDw''
The error I keep getting is this . . .
Msg 170, Level 15, State 1, Server X, Line 1Line 1: Incorrect syntax near 'NmsDwSqlScript'.
I am just guessing that it's because I am trying to use environment variables for the parameter values in the SQL string.
Any help on this problem would be appreciated.
THANK YOU!!!
Never mind . . . Figured it out.
Had to write the script like this . . .
-S %serverName% -d NmsDw -Q "exec spProcFileLogIns '%INVOICEFILE%', '%NmsDw_FileSize%', '%NmsDw_FileTms%', NmsInvoiceDw" -e -E