Hello. I am trying to run the following BCP script:
If I type this manually from the command line it runs perfectly and exports 5 lines to the resulting text file.
If I run as a batch file, I pretty much get the bcp /? window that shows the usage and all of the switches.
As a side note. The batch file works great if I change [LIKE 'A%'] TO [= 'ADAMS']. The script seems to fail when using LIKE and a % wildcard.
I also tried putting the database directly after the c:\binn\bcp:
If I run as a batch file I get the same bcp /? window. If I run directly in command line I get an error: "Copy direction must be either 'in', 'out', or 'format.'
Any idea what is different in a batch file vs typing directly into command line where it won't use the LIKE clause?
Thanks!
Code:
c:\binn\bcp "select script from backupdatabases..backupscript where dbname like 'a%'" queryout e:\mssql2000\mssql\backup\backupscripts\backupA.txt -S servername -U username -P password -c
If I type this manually from the command line it runs perfectly and exports 5 lines to the resulting text file.
If I run as a batch file, I pretty much get the bcp /? window that shows the usage and all of the switches.
As a side note. The batch file works great if I change [LIKE 'A%'] TO [= 'ADAMS']. The script seems to fail when using LIKE and a % wildcard.
I also tried putting the database directly after the c:\binn\bcp:
Code:
c:\binn\bcp backupdatabases "select script from backupscript where dbname like 'a%'" queryout e:\mssql2000\mssql\backup\backupscripts\backupA.txt -S servername -U username -P password -c
If I run as a batch file I get the same bcp /? window. If I run directly in command line I get an error: "Copy direction must be either 'in', 'out', or 'format.'
Any idea what is different in a batch file vs typing directly into command line where it won't use the LIKE clause?
Thanks!