Introduction to sqlcmd utility in SQL Server 2005
Introduction
I decided to write this article to respond to a request of one usergroup, which requested that they would like to learn sqlcmd 101.SQL Server 2005 has introduced a new utility
sqlcmd to
run ad hoc Transact-SQL statements and scripts from command prompt.
T-SQL commands are entered in command prompt window and the result is
displayed in the same window, unless the result set is sent to the
output files. sqlcmd can execute single T-SQL statement as well as batch file. sqlcmd utility can connect to earlier versions of SQL Server as well. The sqlcmd utility uses the OLE DB provider to execute T-SQL commands, whereas SQL ServerManagement Studio uses .NET sqlclient to execute sqlcmd script,
this can lead to different results in certain cases. (If you have an
example of this, please let me know. I will post it here.) sqlcmd is an enhanced version of the isql and osql and it provides way more functionality than the other two options. In other words, sqlcmd is a better replacement of isql (which will be deprecated eventually) and osql (not included in SQL Server 2005 RTM). sqlcmd can work two modes:- BATCH and
- interactive
sqlcmd. Step 1: Go to Start >> Run >> Type "cmd" and press enter:
sqlcmd. The use of
sqlcmd syntax is very easy, however, this command can perform many powerful tasks. We will see that in future articles.Source:http://www.codeproject.com/Articles/20372/SQL-SERVER-2005-Introduction-and-Explanation-to-sq
No comments:
Post a Comment