Search code examples
sqlcmdsqlcmd

why did sqlcmd -v foo="c:\path" eat the "c:"?


I have foo.sql as:

print 'foo=$(foo)'

Then I have in foo.cmd the following shell script:

sqlcmd -i foo.sql -v foo="c:\path"

Running foo.cmd prints:

foo=\path

how do I escape the "c:"? Is dos-shell eating it, or is it sqlcmd?


Solution

  • OK, my mistake. the above does work.

    What i did wrong was doing: sqlcmd -i foo.sql -v foo='c:\path'

    (single quote, since I tried to pass them as ' ' sql string) that won't work. it will chop the c: