Thank You,
I will also try it out.
But I tried this .. and got the output.
**********************************************************************************
set naic=1261110
set tnpath=C:\tnvintrailerset year=%date:~-4,4%
echo year=%year%
set month=%date:~-10,2%
if "%month:~0,1%" == " " set month=0%month:~1,1%
echo month=%month%
set day=%date:~-7,2%
if "%day:~0,1%" == " " set day=0%day:~1,1%
echo day=%day%
set datetime=%year%%month%%day%
echo datetimef=%datetimef%
SQLCMD -S SQLSANDBOX -E -Q "[St].[dbo].[P_tntr] "
bcp [St].[dbo].[TmpTNVINTRInfo] out "%tnpath%tnvin_%datetime%%naic%.txt" -c -T -S SQLSANDBOX
SQLCMD -S SQLSANDBOX -E -Q "DROP TABLE [St].[dbo].[TmpTNVINTRInfo]"
****************************************************************************************