Wednesday, March 7, 2012

Large text Insert

Hi,

I have a large text which contains special characters and I need to insert it in "ErvTxt" field which is a varchar field.

I get an error:

Error:Line 1: Incorrect syntax near '1'.
Unclosed quotation mark before the character string ', 19 )'.
At line 4467SQL statement: INSERT INTO tbl1 (ZPERS, Status, ErvTxt, VENTS, DNR, ANAME, Fall, Zust, GER, Empf, BET, SSK, GA, JAHR, PZ, LAUFNR, RVLAUFNR, EDAT, ETIME, VDAT, UTLAUFNR, Bew, AINR, ErvNr, PrintStatus, FristNr, HDAT, HTIME, RVExportiert, CrDat, CrPers, GATT, AZ, NR) VALUES ( 'STS', -1, '0123\'1\'00\'0138-33/02(1)\'J\'F\'452\'R020311\'KL01\'ZB\'01\'C\'00001\'03\'i\'000000000\'430200001\'20030116\'0905\'\'000000460\'20030116\'1100\'\n0242\'3\'15\'00\'00000001000\'\'\'-\'00000000000100\'\'\'\'\'\'\'\'00100?¥00000000000100?¥00000000000100?¥0000000000010000000000015699200000\'0000000363?¥00000000001000?¥00000000001000 rrrrrrrrrrrr ssss\'\'RI20030\'101012003010\'1200301160\'0\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\n', '', 0, '0138-33/02(1)', 'J', 'F', 97, 'R020311', 'KL01', 'ZB', 1, 3, 'i', 0, 430200001, '2003-01-16 12:00:00', '1899-12-30 09:05:00', NULL, 460, 0, 2927, 1744, 0, 0, '2003-01-16 12:00:00', '1899-12-30 11:00:00', NULL, '2003-01-16 04:04:04', 'STS', 'C', '00001', 19 )

Can anyone tell me what's wrong?

Thanks.

You need to escape the single quotes inside the varchar/string value.

No comments:

Post a Comment