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!!!