Esta página foi útil?
Seus comentários sobre este conteúdo são importantes. Queremos saber sua opinião.
Comentários adicionais?
1500 caracteres restantes
Biblioteca MSDN
EN
Este conteúdo não está disponível em seu idioma, mas aqui está a versão em inglês.

sqlcmd Utility Tutorial

This tutorial provides a brief introduction to the sqlcmd utility for users who do not have experience using a command-line utility.

You can use the sqlcmd utility, a Microsoft Win32 command prompt utility, to run ad hoc Transact-SQL statements and scripts. To use sqlcmd interactively, or to build script files that you can run by using sqlcmd, you must understand Transact-SQL. The sqlcmd utility typically is used in these ways:

In the sqlcmd environment, you can interactively enter Transact-SQL statements the same way you enter them when you are working at the command prompt. The results are displayed in the Command Prompt window, unless you choose otherwise. Later in the tutorial you will learn how to send result sets to output files.

You can submit a sqlcmd job either by specifying a single Transact-SQL statement to execute or by pointing the utility to a script file that contains Transact-SQL statements to execute. sqlcmd can connect to earlier versions of SQL Server.

In this tutorial, you will learn how to connect to a named instance of Microsoft SQL Server by using sqlcmd. You will also learn how to run a Transact-SQL script from a file that generates a list of Adventure Works Cycles employee names and addresses and then store those names and addresses in a text file.

Lesson 1: Starting sqlcmd

In this lesson, you will learn how to start sqlcmd and use some of its common options.

Lesson 2: Running Transact-SQL Script Files by Using sqlcmd

In this lesson, you will learn how to use sqlcmd to run Transact-SQL code that is stored in script files.

ms170207.note(en-US,SQL.90).gifNote:
When you are reviewing tutorials, we recommend that you add next and previous buttons to the document viewer toolbar. For more information, see Adding Next and Previous Buttons to Help.

Contribuições da comunidade

ADICIONAR
A Microsoft está realizando uma pesquisa online para saber sua opinião sobre o site do MSDN. Se você optar por participar, a pesquisa online lhe será apresentada quando você sair do site do MSDN.

Deseja participar?
Mostrar:
© 2015 Microsoft