Subject sql decimals
From Charlie <tm@tc.com>
Date Mon, 08 Jan 2024 05:26:39 -0500
Newsgroups dbase.getting-started

Thanks guys..  I had used cast before.  Forgot about it.  And it solved the problem.

Mervyn Bick Wrote:

> On 2024/01/08 08:31, Mervyn Bick wrote:
>
> > The SQL function to change a column's type is CAST().
> >
> >
> >    sql = "select cast(sum(qty) as int) as qty from collection"
> >
> >
> > It's optional but if you don't include the "as qty" in the statement the
> > field in the rowset will be named "SUM of qty"
>
> P.S
>
> If you are simply going to display the value and not use it in a
> calculation you could convert the value to characters.  This would allow
> you to display it left justified in an entryfield without the leading
> spaces converting to an integer will introduce.
>
> sql = "select cast(sum(qty) as char(3)) as qty from collection"
>
> Just make sure you make the character field wide enough to hold the value.
>
> Mervyn.