sql decimal to 2 places
CAST(MyNumber AS NUMERIC(18,2))
sql server decimal
-- DECIMAL(p,s) p: number of digits (lkeft+right) s: number of digits (right)
-- NUMERIC and DECIMAL are synonyms
CREATE TABLE test.sql_decimal (
dec_col DECIMAL (4, 2) -- Max total 4 digits, including 2 after decimal
);
INSERT INTO test.sql_decimal (dec_col) VALUES (10.05); -- OK 4 digits
INSERT INTO test.sql_decimal (dec_col) VALUES (21.0425); -- KO
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us