简体   繁体   English

如何在SQL Server 2012中使用TRUNC函数,因为“TRUNC”不是公认的内置函数名。'?

[英]How to use TRUNC function in SQL server 2012, as am getting 'TRUNC' is not a recognized built-in function name.'?

How to use TRUNC function in SQL Server 2012, as I am getting an error: 如何在SQL Server 2012中使用TRUNC函数,因为我收到错误:

'TRUNC' is not a recognized built-in function name.' “TRUNC”不是公认的内置函数名称。

when I execute the statement 当我执行声明

SELECT TRUNC(30.95, 1)

in SQL Server 2012 在SQL Server 2012中

http://msdn.microsoft.com/en-us/library/ee634907.aspx http://msdn.microsoft.com/en-us/library/ee634907.aspx

It is a DAX function, not a built in SQL function. 它是DAX函数,而不是内置的SQL函数。 It looks like those would be for use in Excel. 看起来这些将用于Excel。

http://technet.microsoft.com/en-us/library/gg399181.aspx http://technet.microsoft.com/en-us/library/gg399181.aspx

The built in function for SQL Server 2012 are here: SQL Server 2012的内置函数在这里:

http://msdn.microsoft.com/en-us/library/ms177516.aspx http://msdn.microsoft.com/en-us/library/ms177516.aspx

ROUND ( 30.95 , 1 , 1 )

When the third parameter != 0 it truncates rather than rounds 当第三个参数!= 0时,它会截断而不是舍入

http://msdn.microsoft.com/en-us/library/ms175003(SQL.90).aspx http://msdn.microsoft.com/en-us/library/ms175003(SQL.90).aspx

Thanks to https://stackoverflow.com/a/44093/44743 感谢https://stackoverflow.com/a/44093/44743

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM