piyush23424 Posted March 28, 2010 Share Posted March 28, 2010 i am saving a 10 digits numbers(1234567890) in the database. it's working fine but when number starts with leading zero. then only nine digits gets saved in the database(excluding leading zero) and i am getting this problem when number starts with zero. Please help me Thanks in advance. Quote Link to comment Share on other sites More sharing options...
teamatomic Posted March 28, 2010 Share Posted March 28, 2010 try varchar or char HTH Teamatomic Quote Link to comment Share on other sites More sharing options...
zeodragonzord Posted March 28, 2010 Share Posted March 28, 2010 If you need a leading zero, you must store it has characters, not integers. As teamatomic says, CHAR or VARCHAR should work, though if you're expecting 10 numbers always, then use CHAR. Quote Link to comment Share on other sites More sharing options...
jmajeremy Posted March 28, 2010 Share Posted March 28, 2010 Indeed, if you use an INT type field, then it will automatically try to convert it to a basic number, which means truncating any leading zeros. If you want to maintain the integrity of it as a string you should use a CHAR, VARCHAR or even TEXT type field. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.