Formatted text strings, how to use bcp to import a database, single quotes ' How to handle

Source: Internet
Author: User
Tags format sql server driver odbc sql server driver
Import Data | database
I use the following format:

EXEC Master.. xp_cmdshell ' bcp SERP.dbo.IOData in C:\200410\07.txt-fc:\200410\iodata.txt-usa-p '
System error:
Error = [Microsoft][odbc sql Server Driver] Invalid character value for styling description

The text format is:
' 1 ', ' 20041007 ', ' 000330 ', ' 0812 ', ' A0001 '
' 5 ', ' 20041007 ', ' 003105 ', ' 0812 ', ' A0002 '
' 6 ', ' 20041007 ', ' 003415 ', ' 0447 ', ' A0002 '
' 6 ', ' 20041007 ', ' 003417 ', ' 0239 ', ' A0002 '
' 6 ', ' 20041007 ', ' 004422 ', ' 0799 ', ' A0002 '
' 1 ', ' 20041007 ', ' 011803 ', ' 0005 ', ' A0001 '

The format file is:
8.0
6
1 SQLCHAR 1 2 ", 1 Door" "
2 SQLCHAR 1 1 ", 2 Control" "
3 SQLCHAR 1 8 "," 3 iodate chinese_prc_ci_as
4 SQLCHAR 1 6 "," 4 iotime chinese_prc_ci_as
5 SQLCHAR 1 4 "," 5 Cardno chinese_prc_ci_as
6 SQLCHAR 1 5 "\ r \ n" 6 Flag chinese_prc_ci_as

The database table format is:
Door int
control int
Iodate Char 8
Iotime Char 6
Cardno Char 4
Flag Char 5



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.