Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what is numeric(18, 0) in sql server 2008 r2

I found a table with this a column from this data type

numeric(18, 0) 

what is that please? and why does 0 and 18 mean

I already check this question Difference between numeric, float and decimal in SQL Server but couldn't understand it.\

can I add (-10) in that column?

can I add all negative number in that column?

can I add any positive number in that column?

Update 1

This is a sample of the data I found in that column

100 263 13 2 9 4 3 3 28 15 33 16 135 50 64 60 100 500 150 

Update 2 Is it possible to have - and + ?

like image 527
Agnieszka Polec Avatar asked Aug 07 '14 19:08

Agnieszka Polec


1 Answers

The first value is the precision and the second is the scale, so 18,0 is essentially 18 digits with 0 digits after the decimal place. If you had 18,2 for example, you would have 18 digits, two of which would come after the decimal...

example of 18,2: 1234567890123456.12

There is no functional difference between numeric and decimal, other that the name and I think I recall that numeric came first, as in an earlier version.

And to answer, "can I add (-10) in that column?" - Yes, you can.

like image 150
Christian Phillips Avatar answered Sep 19 '22 10:09

Christian Phillips