Tuesday, October 20, 2015

sqlcmed and osql locations on Windows for SQL 2012 and above

FYI, MS did it again and moved the location of the SQL tools to here:
C:\Program Files\Microsoft SQL Server\110\Tools\Binn

in it we can find:
"C:\Program Files\Microsoft SQL Server\110\Tools\Binn\OSQL.EXE"
"C:\Program Files\Microsoft SQL Server\110\Tools\Binn\SQLCMD.EXE"

 with these we can run .sql files using following format for cmd, then put the cmd in a Task Scheduler and we have a quick and easy periodic SQL polling service,

e.g:
sqlcmd.exe  -S MyServer.com  -d Dbname -U UID-P "SomePWD" -i "C:\Temp\Run.sql"

No comments:

Post a Comment