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
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Data Type

Author  Topic 

Steve2106
Posting Yak Master

183 Posts

Posted - 2010-07-23 : 10:47:06
Hi There,

Can someone tell me what datatype I should use to capture data of:

1.1
1.2
1.3
...
1.9
1.10

Every time I enter 1.1 it automatically gets converted to 1.10 I don't want sql to do that. I do not want a zero added to every thing I enter. If I enter 1.3 I don't want 1.30.
It has to be in a number format as I need to order by it and if it's text it orders wrong. i.e.
1.1
1.10 ** wrong should come after 1.9
1.2
1.3
1.4

Any help would be appreciated.

Best Regards,

Steve

yosiasz
Master Smack Fu Yak Hacker

1635 Posts

Posted - 2010-07-23 : 10:52:53
I would suggest decimal(10,2)

If you don't have the passion to help people, you have no passion
Go to Top of Page

Steve2106
Posting Yak Master

183 Posts

Posted - 2010-07-23 : 11:08:42
Hi Yosiasz,

Thanks for the reply.
I did try decimal(10,2) but when I add the data 1.1 it is saved as 1.10
I need it to stay 1.1

Best Regards,

Steve
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2010-07-23 : 11:15:57
You're discussing a formatting issue, not a data type issue. Best to use varchar instead.
Go to Top of Page
   

- Advertisement -