Problem:-
In
somehow we can’t find sqlcmd.exe location easily and that may be stress in a difficult situation like the down of one critical production server and for
that, I figure out a solution for that problem by running below script to find
where sqlcmd.exe in my server regardless of the location of SQL Server setup
files, commonly that used when using Windows Core as an OS with SQL Server.
I want to
point out that yes, we can use Powershell instead by using Invoke-sqlcmd cmdlet. I know not all of us
know Powershell and most of us do know T-SQL. Until that changes happen and I
expect it will 😃 SQLCMD
will be around.