By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,504 Members | 1,194 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,504 IT Pros & Developers. It's quick & easy.

sql command error

P: 2
Respected Sir,

I run once sql querry in sql 2000 but show error. pls give me soluction now.

SELECT a.BILL_DATE,
COUNT (DISTINCT a.bill_number + ' ' + a.bill_date + ' ' + a.till_number) nob,
SUM (a.net_amt) bill_value
FROM bill_detail b, bill_header a
WHERE b.bill_date='10-feb-08'
AND a.bill_date = b.bill_date
AND a.bill_number = b.bill_number
AND a.till_number = b.till_number
AND a.bill_status = 'B'
--AND b.net_amt > 199
GROUP BY a.bill_date

show error--------------------

Server: Msg 8114, Level 16, State 5, Line 1
Error converting data type varchar to numeric.
Feb 11 '08 #1
Share this Question
Share on Google+
3 Replies


debasisdas
Expert 5K+
P: 8,127
The error message is self explanatory.
Feb 11 '08 #2

P: 2
SELECT TO_CHAR (&start_date, 'DD MON')
|| ' TO '
|| TO_CHAR (&end_date, 'DD MON YY') AS BILL_DATE,
COUNT (DISTINCT a.bill_number || a.bill_date || a.till_number) nob,
SUM (a.net_amt) bill_value
FROM bill_detail a, bill_header b
WHERE b.bill_date BETWEEN &START_DATE AND &END_DATE
AND a.bill_date = b.bill_date
AND a.bill_number = b.bill_number
AND a.till_number = b.till_number
AND b.bill_status = 'B'
--AND b.net_amt > 199
GROUP BY b.bill_date

HOW RUN ABOVE QUERRY IN SQL SERVER 2000
Feb 12 '08 #3

deepuv04
Expert 100+
P: 227
SELECT TO_CHAR (&start_date, 'DD MON')
|| ' TO '
|| TO_CHAR (&end_date, 'DD MON YY') AS BILL_DATE,
COUNT (DISTINCT a.bill_number || a.bill_date || a.till_number) nob,
SUM (a.net_amt) bill_value
FROM bill_detail a, bill_header b
WHERE b.bill_date BETWEEN &START_DATE AND &END_DATE
AND a.bill_date = b.bill_date
AND a.bill_number = b.bill_number
AND a.till_number = b.till_number
AND b.bill_status = 'B'
--AND b.net_amt > 199
GROUP BY b.bill_date

HOW RUN ABOVE QUERRY IN SQL SERVER 2000
try the following query

SELECT convert(varchar(15),@start_date, 106)
+ ' TO '
+ convert(varchar(15),@end_date, 106) AS BILL_DATE,
COUNT (DISTINCT a.bill_number || a.bill_date || a.till_number) nob,
SUM (a.net_amt) bill_value
FROM bill_detail a, bill_header b
WHERE b.bill_date BETWEEN @start_date AND @end_date
AND a.bill_date = b.bill_date
AND a.bill_number = b.bill_number
AND a.till_number = b.till_number
AND b.bill_status = 'B'
--AND b.net_amt > 199
GROUP BY b.bill_date

thnks
Feb 12 '08 #4

Post your reply

Sign in to post your reply or Sign up for a free account.