我正在使用SSRS报告,但我的时代有问题。在SQL中,他们将我想要的方式显示为00:00:00:00,但在SSRS FastestSegmentTime和SlowestSegmentTime中将以00:00:00:00.0000000的形式出现。我已经尝试格式化它进入的文本框但似乎没有任何工作。如果有人知道如何解决这个问题,我将不胜感激!
由于
Thomas James
DECLARE
@vnuID int = 1212,
@StartDate datetime = '30/10/2013',
@EndDate datetime = '30/11/2013'
SELECT
FastestSegmentTime = MIN(CAST(tblTrace.trFinish - tblTrace.trStart AS TIME(2))),
SlowestSegmentTime = MAX(CAST(tblTrace.trFinish - tblTrace.trStart AS TIME(2))),
AvgSegmentTime = CAST(DATEADD(ms, 1000 * AVG(DATEDIFF(SECOND, tblTrace.trStart , tblTrace.trFinish)),0) AS TIME(2))
FROM
tblTrace
INNER JOIN tblUsers ON usrID = tr_usrID
WHERE
(tblTrace.trFinish IS NOT NULL)
AND (tblTrace.trObjectType LIKE 'Segment%')
AND (tblTrace.tr_vnuID = @vnuID)
AND (tblTrace.trStart BETWEEN @StartDate AND @EndDate)
AND (tblUsers.usrEmail NOT LIKE '%@test%')
答案 0 :(得分:1)
不是将FastestSegmentTime
列转换为时间(2),而是将其转换为日期时间。然后在文本框表达式中的SSRS中写下:=Format(Fields!time.Value,"HH:mm:ss:ff")
。它将以所需的格式显示值。