locked
Difference between osql and sqlcmd ? RRS feed

  • Question

  • Hello Everyone,

    I am new to sql server.

    Does anyone know difference between OSQL and SQLCMD ?

    OSQL replaced by SQLCMD from SQL2005 onwards ? OSQL is good for SQL2000 and SQLCMD is good from SQL 2005 onwards ?

    Thanks in Advance

    Henary

    Thursday, January 23, 2014 4:53 PM

Answers

  • Hello Henary,

    OSQL is deprecated and shouldn't be used any longer, SqlCmd is the replacement for it.

    The difference is: Different parameter, SqlCmd supports more features and so on; see MSDN for details.


    Olaf Helper

    [ Blog] [ Xing] [ MVP]

    • Marked as answer by Henary Thursday, January 23, 2014 7:30 PM
    Thursday, January 23, 2014 5:18 PM

All replies

  • Hello Henary,

    OSQL is deprecated and shouldn't be used any longer, SqlCmd is the replacement for it.

    The difference is: Different parameter, SqlCmd supports more features and so on; see MSDN for details.


    Olaf Helper

    [ Blog] [ Xing] [ MVP]

    • Marked as answer by Henary Thursday, January 23, 2014 7:30 PM
    Thursday, January 23, 2014 5:18 PM
  • sqlcmd:The sqlcmd utility lets you enter Transact-SQL statements, system procedures, and script files at the command prompt, in Query Editor in SQLCMD mode
    osql : The older, ODBC-based way of command-line communication with SQL Server.

    OSQL is deprecated in later version of SQL 2005

    http://www.mssqltips.com/sqlservertip/1113/find-sql-servers-on-your-network-with-osql-and-sqlcmd/
    https://www.netspi.com/blog/entryid/127/when-databases-attack-hacking-with-the-osql-utility

    --Prashanth

    • Marked as answer by Henary Thursday, January 23, 2014 7:30 PM
    • Unmarked as answer by Henary Thursday, January 23, 2014 7:30 PM
    Thursday, January 23, 2014 5:23 PM