Tips & Tricks

Install Just “OSQL” command line utility

This is an obsolete, yet a powerful tool to test access to a given database server or to do some more complex stuff like building or populating a database.  

It’s a fast, easy way to access the database while working with SQL Server without needing SQL Server Management Studio to install.

Note:
OSQL was replaced with a new utility called SQLCMD

SQLCMD has many advantages as below:

  • Performance
  • SQLCMD supports parameterized variables
  •  SQLCMD support Customized editor
  •  :XML [ONOFF]
  •  :Error STDERRSTDOUT
  •  :Perftrace STDERRSTDOUT
  • Remote Dedicated Admin Connection (DAC)

Still lacks a few things that OSQL had, one of the important things was the way data could be exported into CSV without the count, making the CSV file usable as it was exported.

Installing OSQL:

Method 1:

Install SQL Server 2012 (SP1) Express

Method 2:

If you don’t want to install SQL Server 2012 (SP1) Express, you may use this workaround to just install OSQL :

  1. Install SQLSysClrTypes 2008 r2.msi
  2. Install sqlncli 2008 r2.msi
  3. Install SqlCmdLnUtils 2008.msi
  4. Unzip OSQL.zip to c:\windows\system32

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.