我正在使用 SQL 2008 和 SSRS 2008:
CREATE TABLE [dbo].[DimDates](
[pkDateID] [int] NOT NULL,
[FullDate] [date] NULL,
[DayNumberOfWeek] [tinyint] NULL,
[DayNameOfWeek] [varchar](9) NULL,
[IsLastDayOfMonth] [char](1) NULL,
[MonthName] [varchar](9) NULL,
[CalendarDay] [smallint] NULL,
[CalendarWeek] [tinyint] NULL,
[CalendarMonth] [tinyint] NULL,
[CalendarQuarter] [tinyint] NULL,
[CalendarYear] [smallint] NULL,
[FiscalDay] [smallint] NULL,
[FiscalWeek] [tinyint] NULL,
[FiscalMonth] [tinyint] NULL,
[FiscalQuarter] [tinyint] NULL,
[FiscalYear] [smallint] NULL,
)
GO
CREATE PROCEDURE [dbo].[LookupWeek]
@StartDateID int = NULL
AS
IF @StartDateID IS NULL
SELECT
dd.pkDateID
, dd.FullDate
FROM
dbo.DimDates dd
WHERE
dd.DayNumberOfWeek = 7
AND dd.FullDate <= GETDATE()
ORDER BY
dd.pkDateID DESC
ELSE
SELECT
dd.pkDateID
, dd.FullDate
FROM
dbo.DimDates dd
WHERE
dd.DayNumberOfWeek = 7
AND dd.pkDateID >= @StartDateID
AND dd.FullDate <= GETDATE()
ORDER BY
dd.pkDateID DESC
RETURN 0
GO
我们使用上面的 sp 来填充 SSRS 报告中的 @StartDate 和 @EndDate。在参数的下拉框中显示 FullDate 时会出现此问题,它不显示为日期,而是显示为日期时间并将 12:00:00 AM 添加到每一行。
任何想法为什么或如何阻止它?
谢谢,
——亚伦