March 16, 2010 at 8:39 am
hi,i want to save a 0321 in row of table in database..but when i save 0321 it remove starting 0(zero) ..and save it as 321...
how can i save 0 at start of this number...
March 16, 2010 at 9:26 am
If your column is a numeric column, then it should behave this way. If you need to store the leading zeros, then maybe you should work with strings instead of numeric columns. Can you explain what are you trying to do?
Adi
--------------------------------------------------------------
To know how to ask questions and increase the chances of getting asnwers:
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
March 19, 2010 at 11:50 am
just to add more...change it to varchar and use conversion method when you want to use it or why you putting 0 at initial if you want to make it as numeric.
----------
Ashish
March 19, 2010 at 12:35 pm
It really depends on what the data represents. If it represents numeric data, it needs to be stored as a numeric type like int. Theres a difference in storing and displaying data. If it is numeric, store it as such and display it (via your SPs and Views) as a character with a leading zero.
If it is not a numeric value and some sort of character based code, store it as character.
Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply