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 |
|
alexmarshuk
Starting Member
12 Posts |
Posted - 2010-02-11 : 07:51:30
|
| Hi,I have to write a report which requires me to pull out the server name from within a field. This report is thousands of row so can't do it by hand.How do I do this in SQL?An example of the data within the field is:/O=RCN/OU=CARDIFF/cn=Configuration/cn=Servers/cn=RCN-CARDIFF1/cn=Microsoft Private MDBI want the report to only display RCN-CARDIFF1 (or equivalent server). /CN= always comes before the server name and after.thanks, |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-02-11 : 07:58:48
|
| [code]SELECT SUBSTRING(YouCol,PATINDEX('%Servers/cn=%',YouCol)+11,CHARINDEX('/',YouCol,PATINDEX('%Servers/cn=%',YouCol)+11)-PATINDEX('%Servers/cn=%',YouCol)-11) FROM YourTable[/code]------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
|
|
|