Question about SQL data types

cyberscout

Active Member
Hello,
For a query I try to compare two field from two different tables which are stored as different data types:

- PDDOCO from F4311 which is stored as NUMERIC
- SDRORN from F4211 which is stored as STRING

I tried different things with the CAST and CONVERT SQLs but nothing worked. When I try to convert the STRING to NUMERIC I get an error message "Character in CAST argument not valid".

Can anybody help me with this?

Best regards,
Felix
 
Hi There! You should be able to join/compare the fields using the DIGITS function.
SDRORN=DIGITS(PDDOCO)
 
SQL Record Count

I've tried to find it in the IBM documentation (go figure), but thought you gurus might know off the top of your head.

One of the functions I like in WRKQRY is the ability to get a record count.

How do you get a record count in Interactive SQL?

Thanks!
 
Re: SQL Record Count

[ QUOTE ]
I've tried to find it in the IBM documentation (go figure), but thought you gurus might know off the top of your head.

One of the functions I like in WRKQRY is the ability to get a record count.

How do you get a record count in Interactive SQL?

Thanks!

[/ QUOTE ]

Simple counts you can use:

select count(*) from pd811dta/f0006

More complex: This one counts the work orders by type:

select wasrst, count(*) from pd811dta/f4801
group by wasrst
order by wasrst
 
Back
Top