Mixed-mode arithmetic and datatype hierarchy  Determining precision and scale

Chapter 6: Using and Creating Datatypes

Working with money datatypes

If you are combining money and literals or variables, and you need results of money type, use money literals or variables:

create table mytable
(moneycol money,)
insert into mytable values ($10.00)
select moneycol * $2.5 from mytable

If you are combining money with a float or numeric datatype from column values, use the convert function:

select convert (money, moneycol * percentcol)
    from debits, interest
drop table mytable




Copyright © 2005. Sybase Inc. All rights reserved. Determining precision and scale

View this book as PDF