Run SQL Server 2005 at the command prompt

Source: Internet
Author: User
Tags control characters

 
Using the sqlcmd utility, you can enter Transact-SQL statements, system procedures, and script files at the command prompt, in the Query Editor in SQLCMD mode, in the Windows script file, or in the operating system (Cmd.exe) job step of the SQL Server agent job 。 This utility uses OLE DB to perform Transact-SQL batch processing.

sqlcmd
[{-U login_id [-p password]} |–e trusted Connection}]
[-Z New Password] [-Z New Password and exit]
[-S server_name [\ instance_name]] [-H Wksta_name] [-D db_name]
[-L Login Time_out] [-A dedicated admin connection]
[-I. Input_file] [-O output_file]
[-F < codepage > | I: < codepage > [<, O: < codepage >]]
[-u Unicode Output] [-R [0 | 1] msgs to stderr]
[-R use client regional Settings]
[-Q "CmdLine query"] [-Q "CmdLine query" and exit]
[-e echo input] [-t query Time_out]
[-I enable Quoted Identifiers]
[-V var = "value" ...] [-x Disable variable substitution]
[-H headers] [-S Col_separator] [-W Column_width]
[-W Remove trailing spaces]
[-K [1 | 2] remove[replace] control characters]
[-y Display_width] [-y Display_width]
[-B On Error batch abort] [-V Severitylevel] [-M Error_level]
[-A packet_size] [-C Cmd_end]
[-l [C] list Servers[clean output]]
[-P [1] Print Statistics[colon format]]
[-X [1]] Disable commands, startup script, enviroment variables [and exit]
[-? show syntax summary]

Simple example:
Sqlcmd-u sa-p 1234567-s 192.168.1.1
Note Case,

Run SQL Server 2005 at the command prompt

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.