Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
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.
Hi,I have some record as :Duplex 500 GRBlack Papper 200 GRMagic Paper 50 GRI need to take the number information of those data. so it can resulting 500,200,50Please Help..Thx
gbritton
Master Smack Fu Yak Hacker
2780 Posts
Posted - 2014-11-20 : 13:41:26
YOu can use the function discussed here:http://www.sqlservercentral.com/articles/String+Manipulation/94365/
MuralikrishnaVeera
Posting Yak Master
129 Posts
Posted - 2014-12-01 : 06:37:41
use this
SELECT STUFF((SELECT ','+SUBSTRING(a.Col,PATINDEX('%[0-9]%',a.Col),LEN(a.col)-PATINDEX('%[0-9] %',a.Col)) FROM (SELECT 'Duplex 500 GR' AS ColUNION ALLselect 'Black Papper 200 GR'UNION ALLSELECT 'Magic Paper 50 GR') a FOR XML PATH('')),1,1,'')
---------------Murali KrishnaYou live only once ..If you do it right once is enough.......