Pages

Wednesday, September 11, 2013

SQL SERVER – Get Numeric Value From Alpha Numeric String – UDF for Get Numeric Numbers Only | Journey to SQL Authority with Pinal Dave

SQL is great with String operations. Many times, I use T-SQL to do my string operation. Let us see User Defined Function, which I wrote few days ago, which will return only Numeric values from AlphaNumeric values. CREATE FUNCTION dbo.udf_GetNumeric (@strAlphaNumeric VARCHAR(256)) RETURNS VARCHAR(256) AS BEGIN DECLARE @intAlpha INT SET @intAlpha = PATINDEX('%[^0-9]%', @strAlphaNumeric) BEGIN WHILE @intAlpha… Continue Reading...

Source: SQL SERVER – Get Numeric Value From Alpha Numeric String – UDF for Get Numeric Numbers Only | Journey to SQL Authority with Pinal Dave

No comments:

Post a Comment