MS SQL Server
  Home arrow MS SQL Server arrow Using the SQLCMD in SQL 2005 Server
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Silverlight  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
ASP Web Hosting  
ASP.NET Web Hosting 
Windows Web Hosting
 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
MS SQL SERVER

Using the SQLCMD in SQL 2005 Server
By: Jayaram Krishnaswamy
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 12
    2006-05-15

    Table of Contents:
  • Using the SQLCMD in SQL 2005 Server
  • On using SQLCMD from the command line
  • SQL Server Network Connections
  • SQL Client Connections
  • A simple example of running an interactive session

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Using the SQLCMD in SQL 2005 Server


    (Page 1 of 5 )

    The SQLCMD lets you write SQL commands as well as T-SQL statements. It also has many other interesting features. This article explains the features of SQLCMD and shows you how to use them.

    Introduction

    SQLCMD is the preferred command-line utility in SQL 2005 Server although the OSQL utility can be used side by side with SQLCMD. OSQL is included for backward compatibility to deal with legacy scripts. ISQL has been discontinued.

    SQLCMD can be run both in the DOS screen as well as in the MS SQL Server 2005 Management Studio's query editor in the SQLCMD mode. If you want to use scripting, which brings in features like color coding, parsing and executing scripts, and others, this must be enabled. Enabling SQLCMD allows you to write SQL Commands as well as T-SQL Statements. SQLCMD can be enabled in the query editor as shown in this picture,

    or by going to tools it can be enabled by default as shown in the next picture.

    One of the key advantages of this new command-line utility is its ability to set environmental variables and effectively use them in scripts and send output in XML if needed. This article does not on touch on all these interesting features and myriad other possibilities, but helps you in getting up and running. There are a number of rules that need to be observed in writing commands, but these will not be discussed either, and the reader is directed to BOL (Book On Line).



    More MS SQL Server Articles
    More By Jayaram Krishnaswamy


       · Commandline access to the program is perhaps one of the nicest features any program...
     

    MS SQL SERVER ARTICLES

    - Windows Server 2008 as a Workstation OS
    - An Overview of Windows Server 2008 R2
    - LINQ to MySQL, Oracle and PostgreSQL Provide...
    - Completing the Introduction to Transact-SQL
    - A Brief Introduction to Transact-SQL
    - Lookups and Blocking Bad Data
    - Field Validation Rules for Blocking Bad Data
    - Using Masks to Block Bad Data
    - Blocking Bad Data
    - Using @@ROWCOUNT and TABLE Variables for Dat...
    - How to Use Variables, IF and CASE in Databas...
    - Creating Important Aspects of Notification S...
    - Working wth Variables in Database Interactio...
    - Delving Deeper into Notification Services
    - Notification Services





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 6 Hosted by Hostway
    Stay green...Green IT