September 12, 2012 at 10:10 pm
Hi
The bulk insert failing for the fieldterminator 'p' and i am getting the following error message. The statement working fine if i change the delimiter from 'p' to ',' (comma). But all my data files are generated with 'p' and i cant change field terminator.
Below are the format file & bulk insert statement & error message.
FormatFile -
10.0
42
1 SQLCHAR 0 10 "þ" 1 ID ""
2 SQLCHAR 0 30 "þ" 2 OIC_CONTRACT_NUMBER Latin1_General_CI_AI
3 SQLCHAR 0 30 "þ" 3 OIC_INVOICE_NUMBER Latin1_General_CI_AI
4 SQLCHAR 0 19 "þ" 5 OIC_CUSTOMER_NUMBER ""
5 SQLCHAR 0 10 "þ" 6 OIC_INVOICE_DATE ""
6 SQLCHAR 0 10 "þ" 7 OIC_AGING_BUCKET Latin1_General_CI_AI
7 SQLCHAR 0 8 "þ" 8 OIC_REMIT_TO_CODE Latin1_General_CI_AI
8 SQLCHAR 0 1 "þ" 9 OIC_DAILY_LC ""
9 SQLCHAR 0 0 "þ" 10 OIC_MISC_MEMO Latin1_General_CI_AI
10 SQLCHAR 0 12 "þ" 11 OIC_FACTURA_ISSUED ""
11 SQLCHAR 0 41 "þ" 12 OIC_ACCUM_STATE_RATE ""
12 SQLCHAR 0 41 "þ" 13 OIC_ACCUM_CNTY_RATE ""
13 SQLCHAR 0 41 "þ" 14 OIC_ACCUM_CITY_RATE ""
14 SQLCHAR 0 41 "þ" 15 OIC_ACCUM_TCNTY_RATE ""
15 SQLCHAR 0 41 "þ" 16 OIC_ACCUM_TCITY_RATE ""
16 SQLCHAR 0 12 "þ" 17 OIC_SINGLE_MISC_ASSETS ""
17 SQLCHAR 0 41 "þ" 18 OIC_ACCUM_MISC_STATE_RATE ""
18 SQLCHAR 0 41 "þ" 19 OIC_ACCUM_MISC_CNTY_RATE ""
19 SQLCHAR 0 41 "þ" 20 OIC_ACCUM_MISC_CITY_RATE ""
20 SQLCHAR 0 41 "þ" 21 OIC_ACCUM_MISC_TCNTY_RATE ""
21 SQLCHAR 0 41 "þ" 22 OIC_ACCUM_MISC_TCITY_RATE ""
22 SQLCHAR 0 12 "þ" 23 OIC_SPLIT_PARENT ""
23 SQLCHAR 0 12 "þ" 24 OIC_RECON_DATE ""
24 SQLCHAR 0 6 "þ" 25 OIC_FROM_AU Latin1_General_CI_AI
25 SQLCHAR 0 8 "þ" 26 OIC_BATCH_NUM Latin1_General_CI_AI
26 SQLCHAR 0 12 "þ" 27 OIC_MISC_REV_ORIG ""
27 SQLCHAR 0 12 "þ" 28 OIC_GROUPED ""
28 SQLCHAR 0 2 "þ" 29 OIC_OVERAGE_OI Latin1_General_CI_AI
29 SQLCHAR 0 8 "þ" 30 OIC_INVOICE_SEND_DATE ""
30 SQLCHAR 0 1 "þ" 31 OIC_INVOICE_PRINTED ""
31 SQLCHAR 0 41 "þ" 32 OIC_VAT_REFUND_AMT ""
32 SQLCHAR 0 41 "þ" 33 OIC_LC_FEE_AMT ""
33 SQLCHAR 0 41 "þ" 34 OIC_CHRG_HIST_KEY ""
34 SQLCHAR 0 41 "þ" 35 OIC_LS_AGGR_INV ""
35 SQLCHAR 0 41 "þ" 36 OIC_AGGR_INV ""
36 SQLCHAR 0 41 "þ" 37 OIC_SERV_INT_RENT_AMT ""
37 SQLCHAR 0 41 "þ" 38 OIC_SERV_CONC_AMT ""
38 SQLCHAR 0 8 "þ" 39 OIC_ACT_DUE_DATE ""
39 SQLCHAR 0 41 "þ" 40 OIC_INCOME_AMOUNT ""
40 SQLCHAR 0 41 "þ" 41 OIC_WH_TAX_PCT ""
41 SQLCHAR 0 41 "þ" 42 OIC_WH_TAX_AMT ""
42 SQLCHAR 0 78 "\r" 43 OIC_USAGE_ID Latin1_General_CI_AI
Bulk Insert -
BULK INSERT dbo.LS_OI_CTD_INVOICE_NF
FROM 'D:\fmt\BulkImportFiles\LS_OI_CTD_INVOICE_NF.dat'
WITH
(
FIELDTERMINATOR = 'þ',
ROWTERMINATOR = '',
FORMATFILE = 'D:\fmt\LS4.fmt'
)
go
Error Message -
Msg 4866, Level 16, State 1, Line 2
The bulk load failed. The column is too long in the data file for row 1, column 1. Verify that the field terminator and row terminator are specified correctly.
Msg 7399, Level 16, State 1, Line 2
The OLE DB provider "BULK" for linked server "(null)" reported an error. The provider did not give any information about the error.
Msg 7330, Level 16, State 2, Line 2
Cannot fetch a row from OLE DB provider "BULK" for linked server "(null)".
Please help me on this one and thanks in advance for your support.
Thanks
Surendra
September 13, 2012 at 7:12 am
I don't think you can generate a file with a row terminator of empty string. syntactically, if you opened the file in notepad or a text editor, how you you identify the end of one record and the start of the next.
It would need to be a new line () carriage return (\r) CRLF (\r) or something else.
what weird system is using that symbol as a delimter.
Can you post 2-3 lines of your data, this may help us debug the issue
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply