Solved

Help with Select Statement

Posted on 2009-07-07
2
167 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
execute a MS SQL script as a schedule SQL job 72 123
order a table based on column relationship (parent-child), can it be done? 4 41
sql query Help 12 52
Optimizing a query 3 33
Confronted with some SQL you don't know can be a daunting task. It can be even more daunting if that SQL carries some of the old secret codes used in the Ye Olde query syntax, such as: (+)     as used in Oracle;     *=     =*    as used in Sybase …
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.
Delivering innovative fully-managed cloud services for mission-critical applications requires expertise in multiple areas plus vision and commitment. Meet a few of the people behind the quality services of Concerto.

914 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now