Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
Thiyagu_04
Starting Member
37 Posts |
Posted - 2011-10-04 : 02:52:38
|
Hi,I need to get list of only numeric values in the description column.For eg In a table contain description columnDescription column'the details of 3909 values 4984988''skdjkjsdfjkl 903890 sjdfjk 230'Required Output3909,4984988903890,230 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
|
Thiyagu_04
Starting Member
37 Posts |
Posted - 2011-10-04 : 03:24:05
|
I tried with bellow query it goes infinite loopselect * from dbo.ParseValues('the lasdjkf 3909 jlksjdf 4984988',' ') |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
|
paultech
Yak Posting Veteran
79 Posts |
Posted - 2011-10-04 : 07:14:53
|
try the followin function :create FUNCTION ExtractInteger(@String VARCHAR(2000))RETURNS VARCHAR(1000)ASBEGINDECLARE @Count INTDECLARE @IntNumbers VARCHAR(1000)SET @Count = 0SET @IntNumbers = ''WHILE @Count <= LEN(@String)BEGINIF SUBSTRING(@String,@Count,1) >= '0'AND SUBSTRING(@String,@Count,1) <= '9'BEGINSET @IntNumbers = @IntNumbers + SUBSTRING(@String,@Count,1) ENDSET @Count = @Count + 1ENDGO----test usingSELECT dbo.ExtractInteger('My 3rd Phone Number is 323-111-CALL') |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-10-04 : 07:30:27
|
quote: Originally posted by Thiyagu_04 I tried with bellow query it goes infinite loopselect * from dbo.ParseValues('the lasdjkf 3909 jlksjdf 4984988',' ')
i think you're not using it as suggested. its working as expected for me.------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
vmvadivel
Yak Posting Veteran
69 Posts |
|
|
|
|
|
|