Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Save a 0321 in row of table in database.

Author  Topic 

bilal_119
Starting Member

4 Posts

Posted - 2010-03-16 : 10:57:23
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..
plzz help..

Bilal Sohail

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-03-16 : 11:11:07
You don't want save that value in a row.
You want to save it in a colum of a row in your table.
What is the datatype of that column? If it is a numeric datatype then it is not possible to store leading zeroes.


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-03-16 : 11:22:04
quote:
Originally posted by bilal_119

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..
plzz help..

Bilal Sohail


for that you need to make it varchar which will make situation worse if you want to do any numeric manipulations on it. Are you sure you need to store like this?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

bilal_119
Starting Member

4 Posts

Posted - 2010-03-16 : 11:54:12
@visakh16
thanks Alot...
u solved my problem..

Bilal Sohail
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-03-16 : 11:57:30
welcome

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -