C
cnhotel
Unregistered / Unconfirmed
GUEST, unregistred user!
在sql查询分析器中执行如下语句正常返回一个表:
declare @sql varchar(8000)
set @sql = 'select djrq as 日期,'
select @sql = @sql + 'sum(case zyxm when '''+zyxm+'''
then sl else 0 end) as '''+zyxm+''','
from (select zyxm from bz_mxjdbb where djh='1') as a
select @sql = left(@sql,len(@sql)-1) + ' from bz_mxjdbb where xsdbh=''111'' (注:这里的111我想通过参数传递进去) group by djrq'
exec(@sql)
go
我想在sql中通过ADOQuery执行这个语句并使用这个表.
请问上面的sql语句如何写成函数或过程,然后能在delphi中调用这个函数或过程?
declare @sql varchar(8000)
set @sql = 'select djrq as 日期,'
select @sql = @sql + 'sum(case zyxm when '''+zyxm+'''
then sl else 0 end) as '''+zyxm+''','
from (select zyxm from bz_mxjdbb where djh='1') as a
select @sql = left(@sql,len(@sql)-1) + ' from bz_mxjdbb where xsdbh=''111'' (注:这里的111我想通过参数传递进去) group by djrq'
exec(@sql)
go
我想在sql中通过ADOQuery执行这个语句并使用这个表.
请问上面的sql语句如何写成函数或过程,然后能在delphi中调用这个函数或过程?