• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

A small Sql Question

 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am trying to insert data into sql database and the data comes from a file and gets transferred directly to the database. the problem is that one of my fields is to collect pathnames. now whenever the data reaches the databases the slashes are gone
for ex if the path in the datafile is like \\rhino\users\vol1\sim
then in the database it will be like \rhinousersvol1sim
one way to correct is like adding one more \ after every \ but since it going directly i can't, i was just wondering if there is a way to tell the sql to ignore the slashes
 
Sim Raina
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
does anybody know anything about it?
 
Ranch Hand
Posts: 3244
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A couple of questions:
What is the database?
How is the data being transfered? You said it is automatically, how is it automated? A DTS package on SQL server, a chron job, a scheduled task?
 
Sim Raina
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
it is a mysql datbase , basically i have this log file and it has the data in it so i wrote a java program to parse through the data file and make them into fields and then put into a mysql datatbase now one of the fields in the datat file carry a path for ex \\flag\someting\something
now when this gets transferred to a database it changes to \flagsometingsomething
so i was looking for a way to enforce sql not to ignore "\"
 
Dave Vick
Ranch Hand
Posts: 3244
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sim
Check out the Strings section of the MySQL manual. The \ is an escape character so you'll have to use the \\ to get a single \ into your table. You might want to write a simple method to escape all of the single \ in your String before inserting them.
hope that helps
 
Sim Raina
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks , yeah i inserted "\" by using indexof method
thanks bud
 
No one can make you feel inferior without your consent - Eleanor Roosevelt. tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic