Skip to content

Instantly share code, notes, and snippets.

@zeburek
Last active July 10, 2019 06:56
Show Gist options
  • Save zeburek/08f7fd243b23b1029c27194f391ee8e1 to your computer and use it in GitHub Desktop.
Save zeburek/08f7fd243b23b1029c27194f391ee8e1 to your computer and use it in GitHub Desktop.
:: start sqlcm
@echo off
COLOR 06
cls
echo.
echo.
:start
echo 1. Scan - 1
echo 2. Exit - 2
set /p choice= Input number:
::if not '%choice%'=='' set choice=%choice:~0;1%
if '%choice%'=='1' goto 1
if '%choice%'=='2' goto end
if not '%choice%'=='' echo "%choice%" error
echo
::Исполняемый код с обращением к процедуре в БД и записью в текстовый файл по указанному пути
goto start
:1
for %%a in (
"USE [Astra] EXEC [Chk].[Raiseerror_Get]"
"USE [Astra] EXEC [Apl].[GraphDebetPoteriPfWsp_GetByOtdel] @start_dt = '190701', @end_dt = '190730', @version_id = 1"
) do (
sqlcmd -S GROUND-SQL01\GROUNDSQL01 -U exec_vd_user -P ExecVdUser_2019 -b -Q "%%a"
echo %ERRORLEVEL%
if NOT "%ERRORLEVEL%" == "0" echo Error: %%a
)
goto start
:end
exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment