Execute an SQL script using the bat command

Source: Internet
Author: User

When I used sqlmanagestudio to open an SQL script when I imported a database script, I found that the script was too large and sqlmanagestudio was dead for a long time. Because the script has binary data of images, after reaching 2.6m., a senior at the last company gave me a batch processing command to solve this problem.

Set the followingCodeSave it as a bat file and execute it.

Code
1 Rem ======================================
2 Rem website initialization data _ Chongqing edition. SQL
3 Osql / U sa / P Sasa - S 192.168 . 85.23   - D musicclub _ Liaoning Telecom 1 - R - I. Website initialization data _ Chongqing edition. SQL - O website marketing data _shanxi version .txt
4 Pause

 

The following describes the parameters of the osql command:

Code
1 Osql [ - U logon id] [ - P Password]
2 [ - S server] [ - H host name] [ - E trusted connection]
3 [ - D. Use the database name] [ - L logon timeout value] [ - T query timeout value]
4 [ - H title] [ - S column separator] [ - W column width]
5 [ - A packet size] [ - E echo input] [ - I. The identifier with quotation marks is allowed]
6 [ - L list servers] [ - C command end] [ - D odbc dsn name]
7 [ - Q " Command line query " ] [ - Q " Command line query " And quit]
8 [ - N deletion number method] [ - M error level]
9 [ - Message sent by R to stderr] [ - V severity level]
10 [ - I input file] [ - O output file]
11 [ - P print statistics] [ - B. Abort batch processing when an error occurs]
12 [ - X [ 1 ] Disable the command. [a warning is displayed when you exit]
13 [ - O use the old iSQL to disable the following items]
14 < EOF > Batch Processing
15 Auto Adjust console width
16 Wide message
17 The default error level is - 1 And 1
18 [ -? Show syntax Summary]

 

 

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.