I am trying to learn Sqlcmd utility in PowerShell to run SQL queries, specifically for database administration.
Using Version 15.0.1300.359 NT
But I got confused, what is the difference between Sqlcmd and Invoke-Sqlcmd?
Why is it this command works:
Invoke-Sqlcmd -ServerInstance myinstance -Database AdventureWorks2017 "select top 3 * from [Person].[BusinessEntity]"
And this one does not work:
Invoke-Sqlcmd -S myinstance -d AdventureWorks2017 "select top 3 * from [Person].[BusinessEntity]"
By querying help I can clearly see that I should be able using all those variables:
