Mastering the SQL Server command-line interface
Briefly

SQLCMD is a command-line tool that can be used for running ad-hoc SQL queries and stored procedures on local and remote servers, exporting SQL query output to text or CSV files, and managing SQL Server instances and databases on Windows and Linux.
To install the SQLCMD utility, you can select the native SQL Server client tools during SQL Server installation or install it separately using the SQL Server installation manager. It can be invoked by typing SQLCMD in PowerShell or the command prompt, and options can be viewed via 'SQLCMD -?'.
SQLCMD serves as a versatile tool to connect to SQL Server instances, with an example provided for connecting to the default SQL Server instance on a local machine via the command 'sqlcmd -S Nisarg-PC'.
The article emphasizes the importance of SQLCMD for scenarios where SQL Server Management Studio faces limitations, such as running ad-hoc scripts or recovering crashed instances, positioning it as a valuable alternative for database management.
Read at Sitepoint
[
]
[
|
]