Connecting to SQL database using SQLCMD

Posted by kaleidoscope on Geeks with Blogs See other posts from Geeks with Blogs or by kaleidoscope
Published on Mon, 22 Mar 2010 04:40:45 GMT Indexed on 2010/03/22 6:01 UTC
Read the original article Hit count: 642

Filed under:

As we all know, there are a number of ways you can connect to your SQL Azure Database. One of the quick options is to try to connect to SQL server is SQLCMD.

To start the SQLCMD utility and connect to a named instance of SQL Server

  1. Open a Command Prompt window, and type sqlcmd -S myServer\instanceName. Replace myServer\instanceName with the name of the computer and the instance of SQL Server that you want to connect to.
  2. Press ENTER.

The sqlcmd prompt (1>) indicates that you are connected to the specified instance of SQL Server.

SQL Management Studio offers the facility to use SQLCMD from within SQL scripts by using SQLCMD Mode.

How to: Enable SQLCMD mode in the Transact-SQL Editor (About how to start the editor, see How to: Start the Transact-SQL Editor.)

To toggle SQLCMD mode from the Data menu

1. Open the query in the Transact-SQL editor.

2. On the Data menu, point to Transact-SQL Editor, and click SQLCMD Mode.

To toggle SQLCMD mode from the toolbar

1. Open the query in the Transact-SQL editor.

2. On the Transact-SQL Editor toolbar, click SQLCMD Mode.

To toggle SQLCMD mode from the shortcut menu

1. Open the query in the Transact-SQL editor.

2. Right-click anywhere in the editor window, and then click SQLCMD Mode.

For more information follow below link

http://msdn.microsoft.com/en-us/library/ms170207.aspx

 

Geeta, G

© Geeks with Blogs or respective owner