M
Mangler
I created a query in SQL that works fine but when i put it in the asp
code ( with dreamweaver ) i am getting an error when viewing the
page: expected end of statment...
rsBERProd_cmd.CommandText = "SELECT ISNULL(sum(case when type = 'BD'
and _dte = Convert(Char(8),GETDATE(),112) then qty else 0 end),0) as
Dayqty,ISNULL(sum(case when type = 'BD' and _dte between dateadd(dd,-
(day(GetDate())-1),GetDate()) and dateadd(dd,-(day(dateadd(mm,
1,GetDate()))),dateadd(mm,1,GetDate())) then qty else 0 end),0) as
Monthqty,ISNULL(sum(case when type = 'BD' and Year(_dte) =
Year(GetDate()) then qty else 0 end),0) as Yearqty,ISNULL(sum(case
when type = 'BD' and DatePart("ww", _dte)=DatePart("ww",
GetDate()) then qty else 0 end),0) as weekqty FROM
dbo.warehousebertransfer"
the problem i know is here: ("ww", _dte)=DatePart("ww",
GetDate())
the query needs those quotes so how can i get this to work? i tried
using just single quotes but then i get a sql error.... so can someone
help me make this work on the page?
code ( with dreamweaver ) i am getting an error when viewing the
page: expected end of statment...
rsBERProd_cmd.CommandText = "SELECT ISNULL(sum(case when type = 'BD'
and _dte = Convert(Char(8),GETDATE(),112) then qty else 0 end),0) as
Dayqty,ISNULL(sum(case when type = 'BD' and _dte between dateadd(dd,-
(day(GetDate())-1),GetDate()) and dateadd(dd,-(day(dateadd(mm,
1,GetDate()))),dateadd(mm,1,GetDate())) then qty else 0 end),0) as
Monthqty,ISNULL(sum(case when type = 'BD' and Year(_dte) =
Year(GetDate()) then qty else 0 end),0) as Yearqty,ISNULL(sum(case
when type = 'BD' and DatePart("ww", _dte)=DatePart("ww",
GetDate()) then qty else 0 end),0) as weekqty FROM
dbo.warehousebertransfer"
the problem i know is here: ("ww", _dte)=DatePart("ww",
GetDate())
the query needs those quotes so how can i get this to work? i tried
using just single quotes but then i get a sql error.... so can someone
help me make this work on the page?