Stuck with a simple batch file that runs a bcp command. I need this batch file to loop thru a txt file that contains the tables names.
Here is what I have so far
set hour=%time:~0,2%
if "%hour:~0,1%" == " " set hour=0%hour:~1,1%
echo hour=%hour%
set min=%time:~3,2%
if "%min:~0,1%" == " " set min=0%min:~1,1%
echo min=%min%
set secs=%time:~6,2%
if "%secs:~0,1%" == " " set secs=0%secs:~1,1%
echo secs=%secs%
set year=%date:~-4%
echo year=%year%
set dt=%date:~-4,4%%date:~-10,2%%date:~-7,2%_%hour%%min%%secs%
set filename=%1
bcp TABLE.dbo.%1 OUT C:\temp\%filename%_%dt%.dat -n -T
I like the %1 come from input.txt file that might have 50 table names.
Thank you for your help