CREATE FUNCTION [dbo].[ParseNumbers]
(
@string VARCHAR(50)
)
RETURNS VARCHAR(50)
AS
BEGIN
DECLARE @IncorrectCharLoc SMALLINT
SET @IncorrectCharLoc = PATINDEX('%[^0-9]%', @string)
WHILE @IncorrectCharLoc > 0
BEGIN
SET @string = STUFF(@string, @IncorrectCharLoc, 1, '')
SET @IncorrectCharLoc = PATINDEX('%[^0-9]%', @string)
END
SET @string = @string
RETURN @string
END
-
« SQL Server: Convert to Proper case function | Create row numbers based on the rows available in a table »
Parse Numbers from AlphaNumeric strings
@ 2009-03-27 – 14:04:55
0 Trackbacks to Parse Numbers from AlphaNumeric strings
More interesting posts
- Using a SELECT statement with a searched CASE expression
- Reporting Services Tip
- Create row numbers based on the rows available in a table
- Parse Numbers from AlphaNumeric strings
- SQL Server: Convert to Proper case function
- RS2005: Convert to Proper Case
- DatePicker control for SQL RS2005 SP2
- Data migration in Oracle
- Identify and delete duplicate rows in a table
- Group total summary
