2017-12-12 76 views
-1
Declare @a Decimal; 
Declare @b Decimal; 

Set @a = 100*(Select price From prices Where prodid = 'a4'); 
Set @b = 100+(Select cgst from taxes where prodid = 'a4')+(Select sgst from taxes where prodid = 'a4')+(Select cess from taxes where prodid = 'a4') 

SELECT 
    Round(@a/@b,2) as 'Price per Crtn(excl Taxes)', 
    t.cgst+'%' as 'CGST(%)', 
    t.cgst*ROUND(@a*0.01/@b,2) as 'CGST Per Crtn', 
    t.sgst+'%' as 'SGST(%)', 
    t.sgst*ROUND(@a*0.01/@b,2) as 'SGST Per Crtn', 
    t.cess+'%' as 'CESS(%)',t.cess*ROUND(@a*0.01/@b,2) as 'CESS Per Crtn', 
    r.price as 'Price per Crtn(incl Taxes)', 
    '11' as 'Quantity', 
    '11'*ROUND(@a/@b,2) as 'Total Price(excl Taxes)', 
    Round(r.price*'11',2) as 'Total Price(incl Taxes)' 
FROM 
    products p 
JOIN 
    prices r ON (r.prodid = p.prodid) 
JOIN 
    taxes t ON (t.prodid = r.prodid) 
WHERE 
    p.prodid = 'a4' 

iはDataGridViewの中で上記のクエリの出力を移入しようとしていますと、このエラーから抜け出すに私を助けてくださいfloatにメッセージ8114、レベル16、状態5、行の取得3の変換エラーデータ型varchar型は

+0

を見つけたあなたに@Lamakと@Raska をありがとうhttps://stackoverflow.com/help/mcve)。 –

+0

'cgst'カラムのデータ型は? – Lamak

+0

cgst、sgst、cellは浮動小数点です – Kande

答えて

0

は(あなたが作成する方法のガイドラインに従うことで持っている特定の問題[、最小完全、かつ検証例]にコードを削減してみてください、私は答え

CAST(t.cgst AS varchar)+'%' 
関連する問題