I have the below code in a batch file.
Here MYDB is the database, Activity_Inc.sql
is the script file and ST_Activity-
is the csv file generated with the data. |
is used as the delimiter. Now, the problem is with few records where the data is also having the |
in it. Due to this the generated file is failing to be integrated with the target system.
I need to enclose the field with the double quotes where ever the data is having |
in it.
Please suggest a way for this.
sqlcmd -S . -d MYDB -E -s"|" -W -i D:\Activity_Inc.sql | findstr /V /C:"-" /B > D:\ST_Activity-%date:~6,4%%date:~3,2%%date:~0,2%%time:~0,2%%time:~3,2%.csv