sqlserver中參數問題 |
尚未結案
|
ed_yxb
一般會員 發表:11 回覆:5 積分:3 註冊:2005-03-07 發送簡訊給我 |
我的storedproce
if exists(select 1 from sysobjects where type='P' and name='custom_sp_VReport_Draft ')
drop procedure custom_sp_VReport_Draft
go
create procedure custom_sp_VReport_Draft
@cons varchar(500) --條件
as set nocount on
declare @s varchar(800)
if exists(select 1 from sysobjects where type='U' and name='custom_temp_variance')
drop table custom_temp_variance
select @s=''
select @s='select b.flbh, RTRIM(b.fhgbh) as fhgwlbh,RTRIM(b.fwlmc) as fhgwlmx, RTRIM(b.fwlkd) as fwlkd, RTRIM(b.fhtdw) as fhtdw, RTRIM(a.fgysdm) as fgysbh, RTRIM(a.fgysmc) fgysmc, RTRIM(a.fgyswlbh) fgyswlbh, RTRIM(a.fgyswlmc) as fgyswlmx, RTRIM( a.fgyswlkd) fgyswlkd, RTRIM(a.fgyshtdw) fgyshtdw
into custom_temp_variance
from t_Custom_Draft a,
custom_tb_custom_m b where a.fwlhtbh=b.fhgbh and a.fpurcheck=1 and a.ftasktype=''1'''
@cons ' group by b.flbh, b.fhgbh, b.fwlmc, b.fhtdw, a.fgysdm, a.fgysmc, a.fgyswlbh, a.fgyswlmc, a.fgyshtdw, a.fgyswlkd, fwlkd order by a.fgysdm ' exec (@s)
delete a from custom_temp_variance a inner join custom_tb_vendor b on (fgysbh=b.fgysdm) where b.fstate=1
select * from custom_temp_variance order by fgysbh
set nocount off
return 0
go
在delphi中
我傳這個參數@s
如果@s= 'and (LTRIM(RTRIM(a.fgyswlmc)) <> LTRIM(RTRIM(b.fwlmc)) or a.fgyswlkd<>b.fwlkd or substring(a.fgyswlbh,1,9)<>substring(b.fhgbh,1,9) or a.fgyshtdw<>b.fhtdw) and a.fgysdm between 'A125' and 'A125' and a.flbh between 'A0001' and 'Z9999''
側提示錯誤 如果去掉那些 'LTRIM,RTRIM'那些函數 側能正常運行。
|
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |