In sql server 2012 I design database for pharmaceutical company to store data of orders
Inside this database I have Table order inside it have three fields
Quantity
Unit Cost price
Amount( Quantity * Unit Cost price)
Quantity datatype is integer
What data type i can use for Unit Cost price field and Amount field ?
Amount will be big because production Qunatity from 200000 to 1000000 box in order .
Unit cost price from 1 pound to 200 pound .
so that Which data type store unit cost price and amount in sqlserver 2012?
Tapan PatelPosted May 25, 2017, 9:38 AM
Thiruppathi RPosted May 21, 2017, 5:35 AM
Nilesh ShahPosted May 20, 2017, 8:22 PM
if your quantity is going to be more than that and less than 9223372036854775807, use bigint data type.
if you are sure Unit cost price is going to be only from 1 pound to 200 pound, use smallint datatype.
but dont guess here, ask or clarify with BA. if you need to store fractions either use decimal or money or smallmoney datatype
for amount, use money data type which can store value upto 922337203685477.5807
and I suggest you to use calculated column for amount.