Thursday, 31 December 2015

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
IFOBJECT_ID('dbo.Explanation')> 0
DROPTABLEdbo.Explanation
CREATETABLEdbo.Explanation
(
Decimalcolumndecimal(5,2)
,NumericColumnnumeric(5,2)

);

GO
INSERTINTOdbo.ExplanationVALUES (123, 123);
GO
SELECTDecimalcolumn,NumericColumn

FROMdbo.Explanation;



































EX 2:
IFOBJECT_ID('dbo.Explanation')> 0
DROPTABLEdbo.Explanation
CREATETABLEdbo.Explanation
(
Decimalcolumndecimal(10,4)
,NumericColumnnumeric(10,4)

);

GO
INSERTINTOdbo.ExplanationVALUES (12345.67, 12345.67);
GO
SELECTDecimalcolumn,NumericColumn
FROMdbo.Explanation;



No comments:

Post a Comment