用delphid 的Dbexpress调用存储过程时报错:(50分)

  • 主题发起人 主题发起人 wujmandy
  • 开始时间 开始时间
W

wujmandy

Unregistered / Unconfirmed
GUEST, unregistred user!
用delphid 的Dbexpress中的tsqlstoredproc调用存储过程时报错:cursor not returned from query;还请高手指点.
存储过程如下:
ALTER procedure "Getlandbook_1"
as
declare @sSql nvarchar(4000)
declare @sSql1 nvarchar(4000)

create table #land
(userid varchar(10),
code varchar(10),
datenum varchar(10)
)
set @sSql1='insert into #land'+
' select userid,code,datenum =case when (datediff(day,landdate,getdate())-1)*0.1<0 then
0'+
' else
(datediff(day,landdate,getdate())-1)*0.1 end'+
' from owner'
exec sp_executeSQL @sSql1
set @sSql='select a.userid,b.name,case b.sex when 0 then
''男'' else
''女'' end as sex,c.des,b.idcard,'+
'a.code,convert(varchar(10),a.landdate,120) as landdate ,'+
'datediff(day,a.landdate,getdate()) as tian,cast(d.datenum as char) as datenum'+
' from owner a,userb b,groupb c, #land d'+
' where a.userid=b.userid and b.groupid=c.groupid and a.userid=d.userid and a.code=d.code'
exec sp_executeSQL @sSql
drop table #land
GO
 
后退
顶部