?
Solved

Convert varchar type data into currency or integer

Posted on 2003-03-23
1
Medium Priority
?
707 Views
Last Modified: 2012-06-21
Hi there,

  I have a table with all fields set as varchar data type. Now I woukd like to sum values in some columns but the "SUM()" formulae doesn't work with varchar. I wish to know how should I do to convert the varchar to currency and integer in the query so that I can sum up the values? Thank you.
0
Comment
Question by:allicia
1 Comment
 
LVL 1

Accepted Solution

by:
lslim earned 400 total points
ID: 8193614
Try this

Sum(Convert(money, fieldname1)) for currency and

Sum(Convert(int, fieldname2)) for integer type value


HTH
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Ready to get certified? Check out some courses that help you prepare for third-party exams.
This month, Experts Exchange sat down with resident SQL expert, Jim Horn, for an in-depth look into the makings of a successful career in SQL.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Via a live example, show how to setup several different housekeeping processes for a SQL Server.
Suggested Courses

578 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question