我从水晶报告中得到的错误信息是用普通话语言。
我在运行使用带有3个参数的存储过程的Crystal报表(使用Crystal 9)时收到此消息 - 请参阅下面的SP。我在其中创建了一些临时表,但是当我在sql server上测试它时,它可以工作。但是当我在水晶报告中运行它时会出现错误。
欢迎任何想法。
ALTER PROCEDURE [dbo].[sp_rpt_pbos9003_test2]
(
@moveType VARCHAR(3),
@month VARCHAR(2),
@year VARCHAR(4)
)
AS
BEGIN
CREATE TABLE #Temporary
(
scn VARCHAR(10),
vsl_name VARCHAR(150),
act_arr_dt_tm DATETIME,
act_dept_dt_tm DATETIME,
del_remarks VARCHAR(150),
);
INSERT INTO #Temporary
SELECT t1.scn, t1.vsl_name, t1.act_arr_dt_tm, t1.act_dept_dt_tm, t1.del_remarks
FROM vesvoy t1
ORDER BY t1.scn ASC
CREATE TABLE #TemporaryRelated
( scn VARCHAR(10),
Misc VARCHAR(20),
Misc_amt DECIMAL(12,2),
Cargo VARCHAR(20),
Cargo_amt DECIMAL(12,2),
Vessel VARCHAR(20),
Vessel_amt DECIMAL(12,2),
Credit VARCHAR(20),
Credit_amt DECIMAL(12,2)
)
INSERT INTO #TemporaryRelated
SELECT t2.scn,
MAX(case when t1.inv_num like 'MI%' then t1.inv_num end) as Misc,
MAX(case when t1.inv_num like 'MI%' then t1.inv_amt end) as Misc_amt,
MAX(case when t1.inv_num like 'CI%' then t1.inv_num end) as Cargo,
MAX(case when t1.inv_num like 'CI%' then t1.inv_amt end) as Cargo_amt,
MAX(case when t1.inv_num like 'VI%' then t1.inv_num end) as Vessel,
MAX(case when t1.inv_num like 'VI%' then t1.inv_amt end) as Vessel_amt,
'' as Credit,
'0' as Credit_amt
FROM pbosinvoice t1
INNER JOIN pbosinvoiceitem t2 ON t1.id = t2.master_id
GROUP BY t2.scn
CREATE TABLE #TempInvoiceDetails
(
payment_ind VARCHAR(1),
void_flg SMALLINT,
scn VARCHAR(10),
move_type VARCHAR(3)
)
INSERT INTO #TempInvoiceDetails
SELECT DISTINCT t1.payment_ind,t1.void_flg,t2.scn,t3.move_type
FROM pbosinvoice t1
INNER JOIN pbosinvoiceitem t2 ON t2.master_id = t1.id
INNER JOIN vosvesmovedtl t3 ON t3.scn = t2.scn
WHERE t1.payment_ind='F'
SELECT t1.*,t2.*,t3.payment_ind,t3.void_flg,t3.move_type FROM #Temporary t1
INNER JOIN #TemporaryRelated t2 ON t1.scn = t2.scn
INNER JOIN #TempInvoiceDetails t3 ON t3.scn = t1.scn
WHERE ((t3.move_type = @moveType AND MONTH(t1.act_arr_dt_tm) = @month AND YEAR(t1.act_arr_dt_tm)= @year) OR
(t3.move_type = @moveType AND MONTH(t1.act_dept_dt_tm) = @month AND YEAR(t1.act_dept_dt_tm)= @year))
RETURN
DROP TABLE #Temporary
DROP TABLE #TemporaryRelated
DROP TABLE #TempInvoiceDetails
END