Solved

Help with Select Statement

Posted on 2009-07-07
2
169 Views
Last Modified: 2012-05-07
I'm trying to format the output of and keep getting an error: Conversion failed when converting the varchar value '(ok)' to data type int.

Here is my code:
SELECT          SUM(VOID_COUNT) + '(ok)'  AS 'Voids'
FROM            SALES_SUMMARY
WHERE        (STOREID = 14) AND (check_file_date = '7/6/2009')

I'm trying to produce this output:
Voids
12 (ok)

Any ideas here?
0
Comment
Question by:mattkovo
2 Comments
 
LVL 75

Accepted Solution

by:
Aneesh Retnakaran earned 500 total points
ID: 24800463
SELECT         cast(  SUM(VOID_COUNT) as varchar) + '(ok)'  AS 'Voids'
FROM            SALES_SUMMARY
WHERE        (STOREID = 14) AND (check_file_date = '7/6/2009')

0
 

Author Closing Comment

by:mattkovo
ID: 31600942
I just came up with the same solution.  Thanks!
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

If you find yourself in this situation “I have used SELECT DISTINCT but I’m getting duplicates” then I'm sorry to say you are using the wrong SQL technique as it only does one thing which is: produces whole rows that are unique. If the results you a…
This article describes how to use the timestamp of existing data in a database to allow Tableau to calculate the prior work day instead of relying on case statements or if statements to calculate the days of the week.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

821 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