Jyoti Jodha

Jyoti Jodha

  • NA
  • 1.7k
  • 407.9k

Incorrect syntax near '0'. in Sql Server windows application

Jun 19 2017 1:43 AM
 
Select ROW_NUMBER() over(ORDER BY month(Convert(datetime,Date,105)) ASC) as ID,
DATENAME(MONTH, convert(datetime,Date,105))+'-'+DATENAME(year, convert(datetime,Date,105)) as Month,
sum(case when Amount='' then 0 else cast(isnull(Amount,0) as numeric(18,2)) end) as Amount,

sum(case when Discount='' then 0 else cast(isnull(Discount,0) as numeric(18,2)) end) as Discount,

sum(case when Taxable_Amount='' then 0 else cast(isnull(Taxable_Amount,0) as numeric(18,2)) end) as Taxable_Amount,

sum(case when SGST_Amt='' then 0 else cast(isnull(SGST_Amt,0) as numeric(18,2)) end) as SGST_Amt,

sum(case when CGST_Amt='' then 0 else cast(isnull(CGST_Amt,0) as numeric(18,2)) end) as CGST_Amt,

sum(case when IGST_Amt='' then 0 else cast(isnull( IGST_Amt,0) as numeric(18,2)) end) as IGST_Amt,

sum(case when Addcost='' then 0 else cast(isnull(Addcost,0) as numeric(18,2)) end) as Addcost ,

sum(case when Sub_Discount='' then 0 else cast(isnull(Sub_Discount 0) as numeric(18,2)) end) as Sub_Discount ,

sum(case when Total_Amount=''then 0 else cast(isnull(Total_Amount,0) as numeric(18,2)) end)as Total_Amount

from MainBillForm where Sno=0 group by DATENAME(MONTH, convert(datetime,Date,105))+'-'+DATENAME(year, convert(datetime,Date,105)),
 
Year(Convert(datetime,Date,105)),month(Convert(datetime,Date,105))order by Year(Convert(datetime,Date,105)),month(Convert(datetime,Date,105)) 
 
 

Answers (1)