Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

SQLSERVER backup BCP command description

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Bcp has four actions to choose from.

(1)Import.

This action is done using the in command followed by the name of the file you want to import.

(2)Export.

This action is done using the out command followed by the name of the file to be exported.

(3)Export using SQL statements.

This action is done using the queryout command, which is similar to out except that the data source is not a table or view name, but an SQL statement.

(4)Export format files.

This action is done using the format command followed by the format file name.

Here are some common options:

-f format_file

format_file indicates the format file name. This option depends on the action above, format_file indicates an existing format file if in or out is used, and format indicates a format file to be generated if format is used.

-x

This option is used in conjunction with-f format_file to generate a format file in xml format.

-F first_row

Specifies which row of the exported table to export from or which row of the imported file to import from.

-L last_row

Specifies the end of the row to which the exported table or imported file exports data.

-c

Use char as storage type, no prefix and "\t" as field delimiter and "\n" as row delimiter.

-w

Similar to-c, but used when copying data using the Unicode character set, with nchar as the storage type.

-t field_term

Specifies the character separator, the default is "\t."

-r row_term

Specifies the line separator, default is "\n."

-S server_name[ \instance_name]

Specifies the instance of SQL Server to connect to, or if this option is not specified, bcp connects to the default instance of SQL Server of the native machine. If you want to connect to the default instance on a machine, you only need to specify the machine name.

-U login_id

Specifies the username to connect to SQL Server.

-P password

Specify the username and password to connect to SQL Server.

-T

Specify bcp to log on to SQL Server using a trusted connection. If-T is not specified, -U and-P must be specified.

-k

Specifies that null columns are inserted with null values instead of the default values for this column.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report