Question : how to correct the error 257

hi guys i have this scriot which i am using to see the qty received and in trasact.

when i addd it in SP and check syntax it comes up with error 257 the conversion of varchar to money is not aloow use convert function but i am not using any money integer.

please help
Code Snippet:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
create procedure LTS_QC_GOODS_QUANTITY
 
@date1 datetime,
@date2 datetime,
@week varchar(20)
 
as 
 
begin
 
select
 
            b.branch_code,
 
            b.branch_desc,
 
            Gd.product_no_string,
 
            s.sizes_desc,
 
            c.colour_desc,
 
            sum(gd.quantity_received) Qty_received,
 
            --Sum(Ph.Stock_units_QC) as QC_Quantity,
 
            Sum(gd.quantity_received*pd.current_sp) as Current_SP
 
 
 
from 
 
            goodsreceive_master gm, 
 
            goodsreceive_det gd, 
 
            branch b,
 
            product_detail pd,
 
            colour c, sizes s
 
            --oduct_history ph
 
 
 
where gm.authorised_date between @date1 and @date2
 
and gm.goods_rec_id = gd.goods_rec_id
 
and gd.sku_id = pd.sku_id
 
and pd.colour_id =c.colour_id
 
and pd.sizes_id = s.sizes_id
 
and product_no_string = Gd.product_no_string
 
and b.branch_id = gm.warehouse_id
 
--and gd.sku_id = ph.sku_id
 
and gd.quantity_received > 0
--and branch_code = '999'
 
group by b.branch_desc,Gd.product_no_string,b.branch_code,s.sizes_desc,c.colour_desc
 
Union
 
/*--------QC QTY-------*/
 
select B.BRANCH_DESC,
pm.prod_code,
sum(ph.stock_units_Qc) as QC_stock,
'BLANK',
'BLANK',
'BLANK',
'BLANK'
 
from product_master pm,product_history ph,BRANCH B
 
where PH.week_selector = @week
AND B.BRANCH_ID = PH.BRANCH_ID
and pm.prod_id = ph.product_id 
and  ph.stock_units_QC <>0
 
group by pm.prod_code,B.BRANCH_DESC
 
end

Answer : how to correct the error 257

OK...
Make sure that the datatypes on the second union list are exactly of the same datatype with the first
B.Branch_code on the first union will match with the same on the second,  but it is not possible to map the SUM (..)  and 'Blank'
 
select      b.branch_code,
            b.branch_desc,
            Gd.product_no_string,
            s.sizes_desc,
            c.colour_desc,
            sum(gd.quantity_received) Qty_received,
            --Sum(Ph.Stock_units_QC) as QC_Quantity,
            Sum(gd.quantity_received*pd.current_sp) as Current_SP
 
.....
Union
/*--------QC QTY-------*/
select b.branch_code,
B.BRANCH_DESC,

pm.prod_code,
sum(ph.stock_units_Qc) as QC_stock,
NULL,
NULL,
NULL,
NUll ...
Random Solutions  
 
programming4us programming4us