Result precision and scale for decimal arithmetic expression and aggregate function
Posted in 2003
Topics: General Discussion
I'd like to know what's the result precision and scale of the decimal arithmentic expression and aggregate function. For example, what's the result type of decimal(p1, s1)+decimal(p2, s2) decimal(p1, s1)-decimal(p2, s2) decimal(p1, s1)*decimal(p2, s2) decimal(p1, s1)/decimal(p2, s2) AVG(decimal(p1, s1)) etc It will also be nice if someone tell me which documentation describes the result types of the expressions and functions. Thanks, Lan
Lan Huang wrote: > I'd like to know what's the result precision and scale of the decimal > arithmentic expression and aggregate function. > > For example, what's the result type of > decimal(p1, s1)+decimal(p2, s2) > decimal(p1, s1)-decimal(p2, s2) > decimal(p1, s1)*decimal(p2, s2) > decimal(p1, s1)/decimal(p2, s2) > AVG(decimal(p1, s1)) > etc > > It will also be nice if someone tell me which documentation describes > the result types of the expressions and functions. > > Thanks, > Lan Don't take this as a definitive answer but: - The precision of any floating point data type can vary with the architecture. The are numbers wich cannot be represented exactly in some standard representations. You can find some information in the SQL Reference Guide Regards
Lan Huang wrote in message <48e0b0fb.0306270915.2a98365c@posting.google.com>... >I'd like to know what's the result precision and scale of the decimal >arithmentic expression and aggregate function. > >For example, what's the result type of >decimal(p1, s1)+decimal(p2, s2) >decimal(p1, s1)-decimal(p2, s2) >decimal(p1, s1)*decimal(p2, s2) >decimal(p1, s1)/decimal(p2, s2) >AVG(decimal(p1, s1)) >etc It depends. The easiest way to tell is to run your query through "sqlcmd -T" > >It will also be nice if someone tell me which documentation describes >the result types of the expressions and functions. I'm not sure if there is one. -- RH