Home > Database > Mysql Tutorial > sqlserver的bcp命令特殊符号转义

sqlserver的bcp命令特殊符号转义

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-07 15:15:40
Original
1913 people have browsed it

前两天用sqlserver的BCP命令导入数据,其中列分隔符为[!] 行分隔符为[end],由于两个字符有特殊意义,需要转义,查询资料后,发现BCP转义的前缀很不易样,为^.。详细命令如下 BCP [database].dbo.[table] in C:\dataimp3\table.txt.out -t ^[!]^ -r^[end]^ -

前两天用sqlserver的BCP命令导入数据,其中列分隔符为 行分隔符为,由于两个字符有特殊意义,需要转义,查询资料后,发现BCP转义的前缀很不易样,为^.。详细命令如下

BCP [database].dbo.[table] in  C:\dataimp3\table.txt.out  -t  ^ -r ^  -c  -b 15000 -S  192.168.49.121 -U  sa -P password

还有一种解决方案,把所有含特殊字符的字段加上双引号

BCP [database].dbo.[table] in  "C:\dataimp3\table.txt.out"  -t "" -r ""  -c  -b 15000 -S  192.168.49.121 -U  sa -P password


可以用0x0A表示linux的换行\n

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
Problem with tp6 connecting to sqlserver database
From 1970-01-01 08:00:00
0
0
0
Unable to connect to SQL Server in Laravel
From 1970-01-01 08:00:00
0
0
0
Methods of parsing MYD, MYI, and FRM files
From 1970-01-01 08:00:00
0
0
0
SQLSTATE: User login failed
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template