Jump to content

sql stripping off initial characters


monty 187

Recommended Posts

Hi AllI am currently working on an sql database and I have just noticed something with it. I am using it for coordinates and they are stored as varchar, they are being sent to the database from a java program. I have noticed that when they are sent to be added to the database they start with coordinates 00 and then 01, so the string stored is 003012013011, but when I look in the database it has stored 3012013011, so it is missing the 00 at the begining. Does anyone know what could be wrong??Thanks a million,M

Link to comment
Share on other sites

Most likely its not the database which is stripping the initial zeros. atleast if the datatype of the field is integer it might strip the leading zeros but since you mentioned the datatype is varchar it will not remove leading zeros. check the Java code, also print out the data/query that is sent to the database....

Link to comment
Share on other sites

Most likely its not the database which is stripping the initial zeros. atleast if the datatype of the field is integer it might strip the leading zeros but since you mentioned the datatype is varchar it will not remove leading zeros. check the Java code, also print out the data/query that is sent to the database....
Thanks for the reply. It is really wierd. I have the entry to be added in string format in java. It lists below in the console. The first line of numbers is the string before the query and the second is the string after it. So the string has not changed when the insert is run.one001011021031041051111121131141151network: Connecting socket://localhost: with proxy=DIRECTtwo001011021031041051111121131141151URL: jdbc:mysql://localhost/addConnection: com.mysql.jdbc.Connection@But again in the database it has removed the 00. All the query is doing is inserting a string into the field in the database.M
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...