sql server - How to get other than numerics in a string(removing numerics in strings) in sqlserver -
How to minimize numerics in strings in sqlserver
ForEx: string value: can not be 200 [ 34534]
Result: Not many (other than reulst numerics)
if If you want to sort all numbers from the string, then there are several possible ways:
1) Pure TSQL:
For example (not necessarily the best / beautiful way)
DECLARE @Test VARCHAR (50) SET @Test = 'test12value8 select' DECLARE @ index with digits' @ Index = PatIDx ('% [[0-9]%', @Test) WHILE (@index> 0) BEGIN set @test = LEFT (@Test, @index - 1) + Wright (@Test, (LN (@ Test) - @ Indix SELECT @index = PATINDEX ('% [0-9]%', @Test) END @ test
2) CLR functionality (SQL 2005+) - Create CLR function to copy (i.e. in .NET), and call that function
3) Do not manipulate SQL, return the data back and the calling code is formatting / Clean (which is
The only option I would have to go naturally, unless there is no good reason for it.
Comments
Post a Comment