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 |
|
mclovin
Starting Member
15 Posts |
Posted - 2011-12-21 : 08:10:01
|
| Hello, This is my issue I have this value you in a column "Exception Hardware Refresh,US STATUS: Missing,US STATUS: Backup" and what i need to bring back and show for that value is the words after US STATUS:. Which in the case would be Missing,Backup. Any help on how to extract those words from that value would be appreciated Thanks. |
|
|
RickD
Slow But Sure Yak Herding Master
3608 Posts |
Posted - 2011-12-21 : 08:45:19
|
| PATINDEX and CHARINDEX will help, along with SUBSTRING. |
 |
|
|
mclovin
Starting Member
15 Posts |
Posted - 2011-12-21 : 12:46:36
|
| Thanks RickD for the response but I have being trying different situation using those function and I’m not able to get it done. |
 |
|
|
sunitabeck
Master Smack Fu Yak Hacker
5155 Posts |
Posted - 2011-12-21 : 13:07:40
|
Something like this:REPLACE(STUFF(yourCol,1,CHARINDEX('US STATUS:',yourCol)-1,''),'US STATUS:','') |
 |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
mclovin
Starting Member
15 Posts |
Posted - 2011-12-21 : 13:15:35
|
| Thanks guys I’m going to give them a try. really appreciate it |
 |
|
|
X002548
Not Just a Number
15586 Posts |
Posted - 2011-12-21 : 13:19:08
|
ooovery niceDECLARE @strCol varchar(8000)SET @strCol = 'Exception Hardware Refresh,US STATUS: Missing,US STATUS: Backup'SELECT SUBSTRING(@strCol,CHARINDEX('US STATUS:',@strCol)+11,7)SELECT REPLACE(STUFF(@strCol,1,CHARINDEX('US STATUS:',@strCol)-1,''),'US STATUS:','')Brett8-)Hint: Want your questions answered fast? Follow the direction in this linkhttp://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspxWant to help yourself?http://msdn.microsoft.com/en-us/library/ms130214.aspxhttp://weblogs.sqlteam.com/brettk/http://brettkaiser.blogspot.com/ |
 |
|
|
mclovin
Starting Member
15 Posts |
Posted - 2011-12-23 : 13:24:19
|
| Sorry Guys for not responding quicker but the solutions that you guys give me worked I went with sunitabeck solutions Thanks guys |
 |
|
|
|
|
|
|
|