Use sqlcmd– it’s the most fully featured product.
- sqlcmd: The newest, fanciest command-line interface to SQL Server.
- isql : The older, DB-Library (native SQL Server protocol) way of command-line communication with SQL Server.
- osql : The older, ODBC-based way of command-line communication with SQL Server.
EDIT: Times have changed since I replied on this a couple of years ago. Nowadays, you can also use the invoke-sqlcmd cmdlet in PowerShell. If you’re used to PowerShell or plan to do any scripting of any sophistication, use this instead.