Solved

Help with Select Statement

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

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SQl Query to find x consecutive Nbrs in a Table 30 96
SQL: launch actions one before the other 10 23
Email Header Detail 12 63
Merge two rows in SQL 4 25
by Mark Wills Attending one of Rob Farley's seminars the other day, I heard the phrase "The Accidental DBA" and fell in love with it. It got me thinking about the plight of the newcomer to SQL Server...  So if you are the accidental DBA, or, simp…
Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

809 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