Frank Kalis
Mandip wrote: |
|
Thanks Flo,
Actually I am already aware of this....
.... Just think I have to write an function which can be used multiple times for millions of rows...
So if you have anyother option. most welcome.
| |
Here's a function:
CREATE FUNCTION dbo.RemoveChars(@Input varchar(1000))
RETURNS VARCHAR(1000)
BEGIN
DECLARE @pos INT
SET @Pos = PATINDEX('%[^0-9]%',@Input)
WHILE @Pos > 0
BEGIN
SET @Input = STUFF(@Input,@pos,1,'')
SET @Pos = PATINDEX('%[^0-9]%',@Input)
END
RETURN @Input
END
GO
...but I doubt that it is fun running this against a table with millions of rows. You should probably consider exporting the data, do the scrubbing with a scripting language and import back in.