What are the differences between osql, isql, and sqlcmd?


0

I am interested in using some kind of a command-line utility for SQL Server similar to Oracle's SQL*Plus. SQL Server seems to have several options: osql, isql, and sqlcmd. However, I am not quite certain which one to use.

Do they all essentially do the same thing? Are there any situations where it is preferable to use one over the others?


Share
asked 12 Aug 2022 06:26:55 PM
junaidakhtar

No comment found


Answers

0

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.


Share
answered 12 Aug 2022 06:27:33 PM
junaidakhtar

No comment found

0

I'm not sure what the scope of your question is, but I believe :

isql used DB-Library to communicate to the server and is no longer included after SQL2000

osql used ODBC to communicate to the server and will no longer included after SQL2005

sqlcmd used OLE DB to communicate to the server and is currently the recommended command line tool.


Share
answered 12 Aug 2022 06:28:17 PM
junaidakhtar

No comment found


You must log in or sign up to answer this question.