Click here to Skip to main content
14,362,507 members
Rate this:
Please Sign up or sign in to vote.
See more:
Hi,

I want to conver float number type to local money format but SQL SERVER not accept my convert function.

Here My Converting solution:

FORMAT(360.3678,'c','tr-TR')


So output should like this:

36.036,78


But its getting error with this:

'FORMAT' is not  recognized built-in function name.


How can I solve this issue?

Thanks
Posted
Comments
Tomas Takac 27-Feb-15 3:44am
   
FORMAT[^] is only supported in SQL Server 2012 or newer.
Maciej Los 27-Feb-15 3:50am
   
No, Tomas, you're wrong. Format is known for MS SQL Server 2008 and up.
Sorry, i'm wrong ;)
Tahsin Çetin 27-Feb-15 3:46am
   
OK have you got any solution?
Rate this:
Please Sign up or sign in to vote.

Solution 1

FORMAT function is available from version 2012 onwards. In earlier versions, use this

convert(money,round(360.3678,2)) or cast(360.3678 as money)
   
v3
Rate this:
Please Sign up or sign in to vote.

Solution 2

As Tomas Takac[^] mentioned, Format function is supported in SQL Server 2012 and newer.

The only way to achieve that, is to write custom function[^] which return a text formated the way you want.

See also: CAST and CONVERT[^] and STRING functions[^]

Try!
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100