我正在使用 SSRS 更新表。我有一系列参数,用户将在运行报告之前从标题中选择这些参数。该报告在执行存储过程以更新表后运行。我的问题是,在某些情况下,并非所有情况下都会发生写入,但报告不会显示任何结果。我可以检查表格并且信息已正确更新。
我想知道的是是否有办法将报告延迟到写入存储过程之后。
这是调用的存储过程:
USE [InvoiceSHC]
GO
/****** Object: StoredProcedure [dbo].[MasterDataUpdate] Script Date: 01/25/2013 14:07:58 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: Tim Vavra
-- Create date: 1/15/2013
-- Description: This procedure is designed to update the table MasterData
-- with information entered into SSRS report by Production Assistants.
-- this information will be used to create the invoice for SHC and provide metric
-- information.
-- =============================================
ALTER PROCEDURE [dbo].[MasterDataUpdate]
-- Add the parameters for the stored procedure here
@Ref float,
@Phase nvarchar(255),
@Page nvarchar(255),
@PageType nvarchar(255),
@Percent int,
@ChangeType nvarchar(255),
@UserName varchar(MAX)
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
Insert into MasterData
(Ad,Page,[Page Type],[Percent],Phase,[Change Type],LstChng, [UID])
values( @Ref, @Page, @PageType, @Percent, @Phase, @ChangeType, GETDATE(), @UserName)
end
update MasterData
set [Base Page] =
Case
When [Page] like '[1-99]' then [Page]
When [Page] like '%[A-Z]' then left([Page],1)+((ASCII(convert(varchar,(RIGHT([Page],1))))-64)*.01)
When[Page] like '%-%' then LEFT([Page],1)+(cast(RIGHT([page],2)as int)*.01)+.26
end
update MasterData
set [Alt Type] =
Case
When [Page] like '[1-99]' then 'B'
When [Page] like '%[A-Z]' then 'A'
When[Page] like '%-%' then 'T'
END
这是我在报告中使用的数据集的查询:
SELECT MasterData.Ad, MasterData.Page, MasterData.[Page Type], MasterData.[Percent], MasterData.Phase, MasterData.[Change Type], MasterData.LstChng,
PageCost.Amt AS PageCost, VersionCost.Amt AS VersionCost
FROM MasterData INNER JOIN
PageCost ON MasterData.[Page Type] = PageCost.PageType INNER JOIN
VersionCost ON MasterData.[Change Type] = VersionCost.ChangeType
WHERE (MasterData.Ad = @Ref) AND (MasterData.Phase = @Phase) AND (MasterData.Page = @Page)
我希望这是足够的信息来帮助某人提供解决方案。