Skip to content

Command line utility that waits for SQL Server processes (matching a set of SPIDs or a username) to finish before returning. This is useful when you need a batch script to wait on a query to finish before doing its work.

Flushot/sqlwaitfor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SqlWaitFor

usage: sqlwaitfor [-options]
summary:
   monitors the a set of processes (or all processes belonging to a specific
   user on a sql server instance.) when the matching processes finish, the
   program will exit. this may be useful in batch scripts.

options:
  query (one required):
    -s spid1,spid2,spidN  spid or comma-separated spids to monitor
    -L login              login name to monitor (instead of spids)

  connection (required):
    -S instance           sql server instance to connect to
    -E                    use windows authentication (default)
    -u username           username for sql authentication
    -p password           password for sql authentication

  optional:
    -v              verbose output (includes detailed process/query info)
    -q              quiet mode (all output except for stderr is suppressed)
    -P port         server port to connect to
    -t seconds      seconds to wait in between checks (default: 5)
    -h              help (this screen)

return codes:
  0 success
  1 error occurred (stderr)
  2 invalid argument (stderr)

examples:
  sqlwaitfor -S server\instance -s 13 && echo Finished!
  sqlwaitfor -S server\instance -u user -p pass -s 12,20,567 && run_some_batch_script
  sqlwaitfor -S server -qP 1434 -L domain\username -t 30

About

Command line utility that waits for SQL Server processes (matching a set of SPIDs or a username) to finish before returning. This is useful when you need a batch script to wait on a query to finish before doing its work.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages