Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 

Get your favourite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved in your SSC briefcase from the favorites tab.
Download now (direct download link)

Format numeric values to language specific format

By thomas,

SQL Server returns numeric values always in a internal format. The conversion of numeric values
into a language specific format is usually part of the client. With this User Defined Function, you can do this
on your backend. The function expects 3 parameters: The numeric value, the requested language
and the number of decimals (will be rounded!). All parameters are described in more detail within
the function comment (header). Here're some calling examples:

SELECT dbo.fn_ConvertNumber(1500.555, 1031, 2) AS Example = 1.500,56    -- German
SELECT dbo.fn_ConvertNumber(1500.555, 2057, 2) AS Example = 1,500.56    -- Brit. English/American
SELECT dbo.fn_ConvertNumber(1500.555, 1036, 2) AS Example = 1 500,56    -- Spain, France


Please apologize my english, i'm not native speaker.
Thomas
www.sqlscripter.com

Total article views: 284 | Views in the last 30 days: 1
 
Related Articles
ARTICLE

CLR Table-Valued Function Example with Full Streaming (STVF / TVF)

SQL CLR Table-Valued Functions can stream data back, but there aren't many examples of the quick and...

BLOG

Metadata Functions (OBJECT_NAME for example)

What is a metadata function? According to BOL a metadata function is one that returns data about th...

SCRIPT

Split function with store procedure

This example return a value with split function

FORUM

Triggers Examples

Triggers Examples

FORUM

"function"

"function"

Tags
t-sql    
 
Contribute

Join the most active online SQL Server Community

SQL knowledge, delivered daily, free:

Email address:  

You make SSC a better place

As a member of SQLServerCentral, you get free access to loads of fresh content: thousands of articles and SQL scripts, a library of free eBooks, a weekly database news roundup, a great Q & A platform… And it’s our huge, buzzing community of SQL Server Professionals that makes it such a success.

Join us!

Steve Jones
Editor, SQLServerCentral.com

Already a member? Jump in:

Email address:   Password:   Remember me: Forgotten your password?
Steve Jones