?
Solved

Convert varchar type data into currency or integer

Posted on 2003-03-23
1
Medium Priority
?
702 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
I have a large data set and a SSIS package. How can I load this file in multi threading?
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Via a live example, show how to shrink a transaction log file down to a reasonable size.
Suggested Courses

764 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