Summary of Microsoft SQL Server Execute Script File Issues

Question one:

Today, I got an Excel file with nearly one million pieces of data to import into the database. I first used the built-in Excel locally (2014), and then generated a script file to execute it on the server (2008); the file SQL cannot be opened.

Solution:

Use the built-in sqlcmd tool

The first step: Win+R type: cmd  command, open the command line tool;

Step 2: Type: cd C:\Program Files\Microsoft SQL Server\100\Tools\Binn  (the specific directory path is related to the location of the SQL you installed)

Step 3: Type: sqlcmd -S . -U sa -P 123 -d test -i data.sql

Parameter description: -S  server address  -U  user name  -P  password   -d  database name  -i  script file path 

Reprinted from: https://www.cnblogs.com/zhangjbravo/p/7059099.html

More reference: https://msdn.microsoft.com/en-us/library/ms162773(v=sql.120).aspx

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324710198&siteId=291194637
Recommended