Decimal Vs Numeric (Difference Between Decimal and Numeric)

There is no difference between Decimal and Numeric.Both datatypes perform same on the assigned column.

EX 1:

  1. IFOBJECT_ID('dbo.Explanation') > 0  
  2. DROPTABLEdbo.Explanation  
  3. CREATETABLEdbo.Explanation  
  4. (  
  5.     Decimalcolumndecimal(5, 2), NumericColumnnumeric(5, 2)  
  6.   
  7. );  
  8.   
  9. GO  
  10. INSERTINTOdbo.ExplanationVALUES(123, 123);  
  11. GO  
  12. SELECTDecimalcolumn, NumericColumn  
  13. FROMdbo.Explanation;  
example
EX 2:
  1. IFOBJECT_ID('dbo.Explanation') > 0  
  2. DROPTABLEdbo.Explanation  
  3. CREATETABLEdbo.Explanation(  
  4.     Decimalcolumndecimal(10, 4), NumericColumnnumeric(10, 4)  
  5.   
  6. );  
  7.   
  8. GO  
  9. INSERTINTOdbo.ExplanationVALUES(12345.67, 12345.67);  
  10. GO  
  11. SELECTDecimalcolumn, NumericColumn  
  12. FROMdbo.Explanation;  
example

Ebook Download
View all
Learn
View all