MySQL csv import is truncating charecters -


i have strange problem. using below code import bunch of csv files mysql database.

@echo off setlocal enabledelayedexpansion if /i "%cd%\" neq "%~dp0" pushd "%~dp0" mysql -e "delete  software_it.hardware" -u root  %%f in ("*.csv") (   set old=%%~dpnxf   set new=!old:\=\\!   mysql -e "load data local infile '"!new!"' table software_it.hardware  columns terminated ',' ignore 1 rows" -u root   echo %%~nxf done ) 

to start off with, csv file coming cmd output. have field called "username" , have observed problem in field, starngely. username has format :

trilegal\{username}

now, firstly after import, "\" missing , of names have first charecter missing after "\".

i guessing wrong because of presence of "\". thought problem table , hence used gui way of importing. gui way imported fine. used same table import using above code , same problem again.

i kind of new mysql if can me understand problem, it'd great.

edit: changed "\" "/"

thanks, ss.

the answer escape character, default mysql treats "\" escape character.

add line says escaped '' in code , not use default escape parameters.

p.s: yes know answering myself. came answer after reading. :d


Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -