This batch file is used to find missing documents within Docuphase. 



@echo off

rem USER CONFIGURABLE VARIABLES

set "sqlcmdServer=10.100.0.22"

set "sqlcmdUser=espeed"

set "sqlcmdPassword=deepse"

set "db=espeed"

set "table=_obj_2"

echo %date% %time% > missing.txt


for /f tokens^=*^ delims^=^ eol^= %%A in (  

    'sqlcmd -h -1 -r 1 -Q "Select PointerToSource FROM %db%.dbo.%table% WHERE CreateDate > '2015-12-31' AND status = 'E' "'

) do if exist %%A (    

    echo Checking file %%A

) else (    

    echo File %%A is missing!!!!    

    color cf    

    echo %%A >> missing.txt

)

    start missing.txt

    color