我有一个从存储过程中提取的SSRS报告。没有错,它在Visual Studio中工作正常(右键单击数据集,选择查询)并在SSMS中执行时:
SELECT
asset as add_asset
,[desc] as add_desc
,start_dt as add_start_dt
,est_life as add_est_life
,acq_cost as add_acq_cost
,acc_depr as add_acc_depr
,lst_depr_yr as add_lst_depr_yr
,new_bk_val as add_new_bk_val
,[function_code] as add_function
,function_rollup as add_function_rollup
,fama_status as add_fama_status
,fama_fisc_yr as add_fama_fisc_yr
,fama_fst_yr as add_fama_fst_yr
,disp_fy as add_disp_fy
,spma_old as prev_book
--,fahs_amt
FROM
vw_Fixed_Asset_Audit_Sheet AS faas
INNER JOIN mu_live.dbo.spmaudit
ON spma_key = faas.asset
--INNER JOIN mu_live.dbo.fa_history
--ON a_asset_number = faas.asset
WHERE (
(fama_status LIKE @acctstatus)
AND (function_rollup BETWEEN @frstart AND @frend)
)
AND (
fama_fst_yr = @year
)
AND (
spma_field = 'fama_cur_val'
AND spma_action = 'P'
AND YEAR(spma_date) = @year
)
/*AND (
fahs_reason = 'DE'
AND fahd_dr_cr = 'D'
AND YEAR(fahs_eff_date) = @year
)*/
ORDER BY asset ASC
注意注释代码,即从另一个表中提取相关字段的部分。当我取消注释该代码时,它会在SSMS中正确提取字段和数据。但在Visual Studio中,我没有数据。没有错误,它甚至使用新字段(fahs_amt)更新“报表数据”窗格中数据集中的字段列表,但没有记录。我完全失去了为什么这个查询会在没有错误的情况下失败的原因。有没有人见过这种行为?
答案 0 :(得分:0)
想出来。看起来SSRS在加入时不喜欢观看。我直接加入了fa_history视图中的基础表,它运行得很好。