to make datatype as decimal or double for temprary column

P

pol

Hi all,
In the following sql example , how I can force the datatype as decimal or
as double. the column 'year_overhead' is not a table column. It is temprary
column created by sql. So please let me know how to make the datatype as
decimal or double.

SELECT
roq_salary.empname,
0.00 as year_overhead
FROM roq_salary ;

Something like that
select salaryamt, cast(0 as decimal(8,2)) as overhead from salary

With Regards
Pol
 
A

Allen Browne

If you execute the query under ADO (not merely in the Access interface), you
can create a table with a column of type:
DECIMAL (precision, scale)

CREATE TABLE Table1
SomeField DECIMAL (8,2);
 
P

pol

Thanks for the reply.

Is it possible to create a dummy column (decimal datatype)
with the sql itself.

I can give as follows in Access

Select
contact.name,
contact.addr1
' ' as remark
from contact

In the above example remark is dummy column . But is it possible to create
decimal column

With thanks
Pol
 
S

Stefan Hoffmann

hi,
In the following sql example , how I can force the datatype as decimal or
as double. the column 'year_overhead' is not a table column. It is temprary
column created by sql.
Use CDbl(0) As year_overhead.


mfG
--> stefan <--
 
A

Allen Browne

CDec() will create the right type, but you don't get so set the
scale/presision.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top