delphi中向adoquery中添加字段报错。求改正。

declare@dtstartsmalldatetime,@dtendsmalldatetimeset@dtstart=:pstartset@dtend=:pendsel... declare @dtstart smalldatetime,@dtend smalldatetime
set @dtstart=:pstart
set @dtend=:pend

select '1.按批次' as flag,a.scph,a.pcode,a.type,a.mattype,a.mdate,a.producetype,a.xpcode,a.zjcode,a.planqty,a.qty,(a.planqty-a.qty) as notqty,isnull(e.qty,0) as badqty
,case when a.qty=0 then 0 else isnull(e.qty,0)*1.0/a.qty*100 end as qper
,case when a.qty=0 then 0 else isnull(e.qty,0)*1.0/a.qty end*1000000 as qppm
,isnull(e.qty01,0) as 多胶,isnull(e.qty02,0) as 少胶,isnull(e.qty03,0) as 报废
,isnull(e.qty04,0) as 溢胶,isnull(e.qty05,0) as 气泡,isnull(e.qty06,0) as 裂胶,isnull(e.qty07,0) as 杂物
,isnull(e.qty08,0) as 黑点,isnull(e.qty09,0) as 固晶不良,isnull(e.qty10,0) as 焊线不良,isnull(e.qty11,0) as 焊线报废
,isnull(e.qty12,0) as 固晶报废,isnull(e.qty13,0) as 地检品,isnull(e.qty14,0) as 支架脚不良
from
(select a.scph,b.pcode,c.type,c.mattype,b.xpcode,b.zjcode,b.producetype,b.planqty,sum(a.qty+a.badqty+a.WasteQty+a.IllQty+a.OtherIllQty) as qty
,case when sum(a.qty+a.badqty+a.WasteQty+a.IllQty+a.OtherIllQty)>=b.planqty then convert(varchar(10),max(importtime),121) else '' end as Mdate
from jit_rbb a inner join jit_rwd b on a.scph=b.scph
inner join material c on b.pcode=c.code
inner join Jit_base_step d on a.stepno=d.stepno
where ((b.state<>4 and b.planstartdate<dateadd(m,datediff(m,0,@dtstart)+1,0))
or (b.state=4 and b.enddate>=dateadd(m,datediff(m,0,@dtstart),0)))
and d.stepname='冲压'
group by a.scph,b.pcode,c.type,c.mattype,b.planqty,b.producetype,b.xpcode,b.zjcode) a
left join
(select a.scph,sum(a.qty) as qty,sum(qty01) as qty01,sum(qty02) as qty02 ,sum(qty03) as qty03
,sum(qty04) as qty04 ,sum(qty05) as qty05 ,sum(qty06) as qty06 ,sum(qty07) as qty07
,sum(qty08) as qty08 ,sum(qty09) as qty09 ,sum(qty10) as qty10 ,sum(qty11) as qty11
,sum(qty12) as qty12 ,sum(qty13) as qty13 ,sum(qty14) as qty14
展开
 我来答
百度网友1cbe3bad
2012-08-24 · 超过24用户采纳过TA的回答
知道答主
回答量:113
采纳率:0%
帮助的人:46.4万
展开全部
主要是下面这两句,@dtstart,@dtend赋值的时候是不是用了text类型

declare @dtstart smalldatetime,@dtend smalldatetime
set @dtstart=:pstart
set @dtend=:pend

where ((b.state<>4 and b.planstartdate<dateadd(m,datediff(m,0,@dtstart)+1,0))
or (b.state=4 and b.enddate>=dateadd(m,datediff(m,0,@dtstart),0)))
追问
麻烦你加我一下345565208 备注。谢了。 
text找不到啊
YiFei_erp19
2012-08-23 · TA获得超过1169个赞
知道小有建树答主
回答量:1584
采纳率:40%
帮助的人:457万
展开全部
调用存储过程时,参数格式错误,你用了 TEXT
追问
求详细指点。
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式