Technical Article

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)

You rated this post out of 5. Change rating

2005-11-02 (first published: )

184 reads

Blogs

Parameter Sensitive Plan Optimization in SQL Server 2022. What is it and is it any good?

By

Parameter Sensitive Plan (PSP) optimization is a new feature in SQL Server 2022 that...

Azure chaos STUDIO

By

Chaos engineering is fun but especially important when building solutions in the cloud. It...

Announcing a New Book on SQL from 3Cloud Authors

By

I am proud to announce the launch of a new book, centered around the...

Read the latest Blogs

Forums

Azure DW default schema in a query / proc equal to "Search_Path" in AWS

By digdave7

I know you can't do this in MSSQL, but hoping DW has progressed more....

Call SQL Agent job using different account to one executing powershell

By Dave D

Hi Folks trying the below but having zero luck and was wondering if anybody...

Encrypt Varchar(max) column in SQL Server

By SatishAyyar

I have a varchar(max) column which has sensitive data and want to encrypt it....

Visit the forum

Ask SSC Logo Ask SSC

SQL Server Q&A from the SQLServerCentral community

Get answers