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 |
rash901
Starting Member
8 Posts |
Posted - 2014-10-31 : 02:09:46
|
i have a column name remarks and i want to retrieve data like by deleting some of the leading charaters and some last characters and show the middle one.like remarks has CALLTRANSFER_OVER_SIP:XfrTime=86.05599975585938_enand i want to show only "XfrTime=86.05599975585938" this much |
|
ahmeds08
Aged Yak Warrior
737 Posts |
Posted - 2014-10-31 : 02:56:01
|
is the format of data always the same?Javeed Ahmedhttps://www.linkedin.com/pub/javeed-ahmed/25/5b/95 |
|
|
rash901
Starting Member
8 Posts |
Posted - 2014-10-31 : 05:28:23
|
yes the format is the same though the value of XfrTime differs.. |
|
|
Ifor
Aged Yak Warrior
700 Posts |
Posted - 2014-10-31 : 12:23:38
|
[code]-- *** Test Data ***CREATE TABLE #t( remarks varchar(8000) NOT NULL);INSERT INTO #tSELECT 'CALLTRANSFER_OVER_SIP:XfrTime=86.05599975585938_en';-- *** End Test Data ***WITH StartPosAS( SELECT remarks , CHARINDEX('XfrTime=', remarks) AS XfrTimePos FROM #t)SELECT SUBSTRING(remarks, XfrTimePos + 8, CHARINDEX('_', remarks, XfrTimePos) - XfrTimePos - 8) AS XfrTimeFROM StartPos;[/code] |
|
|
|
|
|