Reporting Services - Excel 具有数字格式的列

Reporting Services - Excel column with number format

我正在使用以下函数在 Reporting Services 2012 中设置计算格式:

=Format(DateAdd("s", (DateDiff(DateInterval.Second, Fields!FechaInicio.Value, Fields!FechaFinal.Value)), "00:00:00"), "HH:mm:ss")

当我将文件导出到 Excel 时,它显示了具有常规数据类型的列。有没有办法将列导出为数字数据类型?

你有两个选择;铸造和转换。请参阅下面的代码并适应您的需求

--Drop Table t

SELECT *
INTO t
FROM (VALUES
   (45, 'alex'),
   (98, 'diana'),
   (32, 'peter'),
   (98, 'daniel'),
   (45, 'alex'),
   (23, 'bob'),
   (98, 'peter')
   )
v (id, name)


Select * 
From t


SELECT CAST(id AS INT) FROM t;
GO
SELECT CONVERT(INT,id) FROM t;
GO

这里是 link 了解更多信息。

https://docs.microsoft.com/en-us/sql/t-sql/functions/cast-and-convert-transact-sql?view=sql-server-ver15