Link to home
Create AccountLog in
Avatar of elimesika
elimesikaFlag for Israel

asked on

sqlcmd script variables

HI

I am trying to run sqlcmd with a script variable that holds a path (see code snippet)
However , sqlcmd does not know how to handle the ':' in the dir variable value and produce the following error :

Sqlcmd: ':\temp\bcp'': Invalid argument. Enter '-?' for help.

I have tried \:  :: and ^:   nothing is working

Please help

Thanks
sqlcmd -S.\SQLEXPRESS -d mydb -Uuser -Ppass -v dir='c:\temp\bcp' -i vdc-export-import.sql

Open in new window

Avatar of Jagdish Devaku
Jagdish Devaku

Hi,


Please check the below link on sqlcmd and will help you you in solving the issue...

http://msdn.microsoft.com/en-us/library/ms162773.aspx

all the best...
Avatar of elimesika

ASKER

JagdishDevaku , the link you have provided has nothing to do with my question. This is the sqlcmd manual page, I know this manual and naturally is was my first station before I asked my question.


 sqlcmd -S.\SQLEXPRESS -d mydb -Uuser -Ppass -v 'dir c:\>\\temp\bcp' -i vdc-export-import.sql
 
 
ASKER CERTIFIED SOLUTION
Avatar of slam69
slam69
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
slam69, your second one was just what I needed
Thanks  for your help.