ping bgcpitsd-mn01 -n 1 > nul if errorlevel 1 ( goto :getdate) else ( osql -UTRANSF…
- User
ping bgcpitsd-mn01 -n 1 > nul if errorlevel 1 ( goto :getdate) else ( osql -UTRANSF -PFSNART -Sbgcpitsd-mn01 -dmaster -Q "set nocount on; select convert(varchar(10), getdate()-1, 120)" -h-1 -w150 > date.tmp set /p date=<date.tmp set yyyy=!date:~1,4! set mm=!date:~6,2! set dd=!date:~9,2! del date.tmp > nul goto :prepare )
make it if not error
- Assistant
You can modify your script to handle a "not error" scenario more explicitly, and to clarify the logic. If you want to reverse the behavior so that the block executes if there is no error when pinging the host (which is usually a good practice), here is the modified version:
ping bgcpitsd-mn01 -n 1 > nul if not errorlevel 1 ( osql -UTRANSF -PFSNART -Sbgcpitsd-mn01 -d master -Q "set nocount on; select convert(varchar(10), getdate()-1, 120)" -h-1 -w150 > date.tmp set /p date=<date.tmp set yyyy=!date:~1,4! set mm=!date:~6,2! set dd=!date:~9,2! del date.tmp > nul goto :prepare ) else ( goto :getdate ) - User
how to make bat cmd to create bat in sql command
- Assistant
- User
i need to create these @echo off setlocal EnableDelayedExpansion
::Get Yesterday osql -UTRANSF -PFSNART -Slocalhost -Q "set nocount on; select convert(varchar(10), getdate()-1, 120)" -h-1 -w150 > date.tmp set /p day=<date.tmp set mm=!day:~6,2! set dd=!day:~9,2! del /q date.tmp > nul
::Get Store Code osql -UTRANSF -PFSNART -Slocalhost -Q "set nocount on; select stcode from estore..pospara" -h-1' > stcode.tmp set /p st_id=<stcode.tmp set st_id=%st_id: =% del /q stcode.tmp > nul
set "brandFile=BRAND_!mm!!dd!.!st_id!" set "departmentFile=DEPARTMENT_!mm!!dd!.!st_id!" set "productFile=PRODUCT_!mm!!dd!.!st_id!"
::FTP WPRX ( echo user hotrn hotrn echo cd .. echo cd .. echo cd Aldata/LIFE/HEAD/SAV/DOWN/POS echo get !brandFile! echo get !departmentFile! echo get !productFile! echo bye ) > ftp_wprx.tmp ftp -n -s:ftp_wprx.tmp 10.4.9.128 del /q ftp_wprx.tmp > nul
endlocal
- Assistant
- User
make bat cmd create these again
- Assistant
- User
- Assistant
- User
- Assistant
- User
- Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.