TextToDecimal

SUMMARY:This UDF script takes a text value(nvarchar) and returns a decimal(18,6) number. If the text value can't be interpreted as numeric, the UDF returns NULL.-----------------------------------------------USAGE: SET @MyDecimal = dbo.TextToDecimal('-$123,456.73')@MyDecimal will now be -123456.730000SET @MyDecimal = dbo.TextToDecimal('-$123,4560.73') --bad number format@MyDecimal will now be NULL------------------------------------------------------DESCRIPTION:The ISNUMERIC function incorrectly returns 1 (True) for many non-numeric text values. Even […]

5 (1)

2005-11-02 (first published: )

168 reads

Blogs

Your First Jupyter Notebook

By

In April, I said I was going to start learning Jupyter Notebooks. It’s November....

Using Visual Studio Code

By

I’m a creature of habit. I have my routine when I get to my...

Docker Containers and Persistent Data

By

(Be sure to checkout the FREE SQLpassion Performance Tuning Training Plan - you get...

Read the latest Blogs

Forums

Numeric and Decimal

By Steve Jones - SSC Editor

Comments posted to this topic are about the item Numeric and Decimal, which is...

Turn If statement into Case

By GrassHopper

How can I convert this into a Case statement so that the query is...

The Conference Springboard

By Steve Jones - SSC Editor

Comments posted to this topic are about the item The Conference Springboard

Visit the forum

Ask SSC

SQL Server Q&A from the SQLServerCentral community

Get answers

Question of the Day

Missing Data

See possible answers