[AccessD] Converting a string to a double in an SQL query.

Arthur Fuller artful at rogers.com
Wed Jul 2 06:52:35 CDT 2003


Look in BOL under CAST and/or CONVERT. The former should work for you, and
the latter is useful in some similar situations.

Arthur

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Michael Tucker
Sent: July 1, 2003 1:17 PM
To: AccessD at databaseadvisors.com
Subject: [AccessD] Converting a string to a double in an SQL query.


Hi everyone,

I'm dealing with an Access Project that is connecting to an SQL Server
database.  I'm trying to produce a query (and a report that reads this
query) to totals a billing amount.  Simple stuff, right?  Well, the designer
of the database decided to make the data type of the BillingAmount field a
string (specifically varchar(15)), thus I cannot sum this field.

I've been trying to create a calculated field in my query that just converts
the BillingAmount field to a number using the function
"CDbl(dbo.Transactions.BillingAmount)".  When I try to run the query however
I get the "CDbl is not a valid function" error.

This would be easy stuff if I were messing with native Access tables but
since these are SQL Server tables then I'm a little out of my experience.
Anyone know how I can do what I'd like to do here?

Thanks.



More information about the AccessD mailing list