The SQL script file is too large.

Source: Internet
Author: User

After I generate a script file db. SQL with the database structure and data, I want to restore the database on another computer for programming and testing. However, when I tried to execute the script on SQL Server manager Studio, the other party told me that the file was too large to open. After some searches, it is found that the following statements can be used through the command line to easily solve the problem. Note: If the script is too large, you can disable the stderr message to speed up execution.

OSQL-U sa-P-S (local) \ SQLExpress-d trw-r-I db. SQL

SQLExpress is my local database server, TRW is the database name, and db. SQL is my script file. The command parameters of the osql tool are as follows:

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 allows the quotation mark identifier]
6 [-L list servers] [-c command end] [-d odbc dsn name]
7 [-q "command line query"] [-Q "command line query" and exit]
8 [-n delete number method] [-m error level]
9 [messages sent from-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 command, [display warning when exiting]
13 [-O disable the following items when using old ISQL]
14 <EOF> Batch Processing
15. automatically adjust the width of the console
16-width message
17 default error levels:-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.