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 2012 Forums
 Transact-SQL (2012)
 decimal with sign

Author  Topic 

Kimi86
Yak Posting Veteran

79 Posts

Posted - 2013-03-27 : 11:36:08
I need to store a decimal number (17 degits before decimal and 2 after )on a table with sign
e.g.
+0000000001234.12


What should be the datatype of the column
dicimal(17,2) does not store sign if +

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2013-03-27 : 11:51:13
The only datatype that will store the plus sign for you is CHAR or VARCHAR.
You also use VARBINARY or BINARY if you don't want the data to be humanly readable.



N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2013-03-27 : 11:52:19
1. decimal(19,2) if you need 17 and 2
2. You don't need to store that data formatted! Display format should be done in the front end when displaying the data.



Too old to Rock'n'Roll too young to die.
Go to Top of Page
   

- Advertisement -