Princess S
Princess S

Reputation: 89

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:

'TRUNC' is not a recognized built-in function name.'

when I execute the statement

SELECT TRUNC(30.95, 1)

in SQL Server 2012

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

Upvotes: 5

Views: 15706

Answers (2)

user2517183
user2517183

Reputation: 126

It is a DAX function, not a built in SQL function. It looks like those would be for use in Excel.

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

The built in function for SQL Server 2012 are here:

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

Upvotes: 8

recursive
recursive

Reputation: 86124

ROUND ( 30.95 , 1 , 1 )

When the third parameter != 0 it truncates rather than rounds

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

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

Upvotes: 4

Related Questions