469,902 Members | 1,815 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,902 developers. It's quick & easy.

sql command error

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
3 1312
debasisdas
8,127 Expert 4TB
The error message is self explanatory.
Feb 11 '08 #2
avi25b
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
227 Expert 100+
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.

Similar topics

12 posts views Thread by Rhino | last post: by
reply views Thread by Andre Azevedo | last post: by
34 posts views Thread by Roman Mashak | last post: by
2 posts views Thread by Taras_96 | last post: by
1 post views Thread by Waqarahmed | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.