当前位置:网站首页>Sqlserver BCP parameter interpretation, character format selection and fault handling summary
Sqlserver BCP parameter interpretation, character format selection and fault handling summary
2022-07-24 21:32:00 【lusklusklusk】

Official documents https://docs.microsoft.com/zh-cn/sql/tools/bcp-utility?view=sql-server-2017
SET OUT_SQLSERVER=-S 192.168.132.63 -U sa -P sccs123
bcp FDC.DBO.tb_First_Five_QC out tb_First_Five_QC.txt -w -k -C 65001 %OUT_SQLSERVER%
If you save the script as a file name bcp.bat Or not -c or -w, When running, always swipe these two lines of data . But not at all , Because it is saved as a file name bcp.bat The real bcp Conflicting commands , Just change it to another name, such as bcp1.bat And plus -c or -w
-C Specify the character set later , Such as 65001 Express UTF-8
-w It exists alone and must exist , Not to say that -w And then there is % Variable %, In general use -w, Use less -c
-F Numbers followed specify which row of the exported table to export , Or from which line of the file being imported
-L Followed by number
Specifies which row the exported table will end in , Or import data from the imported file , Leading to which line ends
-c
Use Char Type as storage type , There is no prefix and "\t" As a field separator , With "\n" As line splitters
-w
and -c similar , Just when using Unicode Character sets are used to copy data , And in nChar As a storage type
-b Followed by number
Express bcp in Import time , Submit every few lines
-n
The native machine that uses the data ( database ) Data types perform bulk copy operations . This option does not prompt for each field , It will use native values .
-N
When performing a bulk copy operation , Use native for non character data ( database ) Data of data type , Use... For character data Unicode character . This option is -w An alternative to option , And has higher performance . This option is mainly used to transfer data from SQL Server One instance of is transferred to another instance . This option does not prompt for each field . If you want to send a message that contains ANSI Extended character data , And hope to take advantage of the performance advantages of native mode , You can use this option .
By using bcp.exe and -N To export data and import it into the same table schema , If there is a fixed length of non Unicode Character column ( for example char(10) ), The system may display a truncation warning .
One way to resolve this warning is to use -n To replace -N.
( Administrators / user ) Use native formats whenever possible (-n) To avoid separator problems . Using native format, you can use SQL Server Export and import . If the data will be imported into non SQL Server database , Then use -c or -w Options from SQL Server Derived data .
If the instance name is slashed , such as select @@servername,SERVERPROPERTY(‘machinename’) Is shown as wodb\prod and DBPROD1, be -S Can not be used when wodb\prod And you want to use DBPROD1\prod or localhost\prod, because -S [server_name[\instance_name]
bcp "select * from RayHistory.dbo.RAY_FinalEpsFCHistory where KaTeX parse error: Undefined control sequence: \BCP at position 46: …=1" queryout L:\̲B̲C̲P̲\RAY_FinalEpsFC…PARTITION.FNDate’
resolvent : The partition table needs to be preceded by the database name
Replace P A R T I T I O N . F N D a t e ( S n a p s h o t D a t e ) by R a y H i s t o r y . PARTITION.FNDate(SnapshotDate) by RayHistory. PARTITION.FNDate(SnapshotDate) by RayHistory.PARTITION.FNDate(SnapshotDate)
边栏推荐
- One bite of Stream(6)
- Summary of yarn Explorer
- Detailed explanation of ThreadLocal
- [jzof] 06 print linked list from end to end
- A simple method -- determine whether the dictionary has changed
- Summary of yarn capacity scheduler
- findContours
- What are intelligent investment advisory products?
- Let's make a nice monthly temperature map of China with ArcGIS
- How does redis realize inventory deduction and prevent oversold? (glory Collection Edition)
猜你喜欢

Rce (no echo)

Day5: three pointers describe a tree

One bite of Stream(7)
![[SOC] the first project of SOC Hello World](/img/ae/326312cb3b5a372c7b8b048936a9f2.png)
[SOC] the first project of SOC Hello World

Unity & facegood audio2face drives face blendshape with audio
![[development tutorial 6] crazy shell arm function mobile phone - interruption experiment tutorial](/img/21/ef2274360e0c5cf19990ab3e46f116.png)
[development tutorial 6] crazy shell arm function mobile phone - interruption experiment tutorial

A simple method of converting SVG to PDF

Redis (12) -- redis server

Alibaba cloud and parallel cloud launched the cloud XR platform to support the rapid landing of immersive experience applications

Huawei Router: basic principle and configuration of Isis (including experiment)
随机推荐
Baidu classic interview question - determine prime (how to optimize?)
Merge sort
Classical review: understanding the "knowledge consistency" of neural networks (ICLR 2020)
[blind box app mall system] function introduction after online unpacking
ERROR 2003 (HY000): Can‘t connect to MySQL server on ‘localhost:3306‘ (10061)
[feature construction] construction method of features
Lenovo Filez helps Zhongshui North achieve safe and efficient file management
Overview and installation of scientific computing toolkit scipyscipy
C WinForm actual operation XML code, including the demonstration of creating, saving, querying and deleting forms
Es+redis+mysql, the high availability architecture design is awesome! (supreme Collection Edition)
Alibaba cloud and parallel cloud launched the cloud XR platform to support the rapid landing of immersive experience applications
What are intelligent investment advisory products?
95. Puzzling switch
Case analysis of building cross department communication system on low code platform
Defects of matrix initialization
Penetration test - command execution injection
Detailed OSPF configuration of layer 3 switch / router [Huawei ENSP experiment]
rogabet note 1.1
C synchronous asynchronous callback state machine async await demo
Baidu PaddlePaddle easydl helps improve the inspection efficiency of high-altitude photovoltaic power stations by 98%