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 |
DLTaylor
Posting Yak Master
136 Posts |
Posted - 2007-10-18 : 11:08:40
|
Using SQL 2000 i have a table with a field containing eg;Field1CLINIC: TSDTNORTH - NORTHGATE CLINIC: BULDY - BULDY PLACE CLINIC: HAEMCNS - HAEMATOLOGY NSP CLINIC: MELCNEW - PLACEIs there a string function i could use to return values;Derived FieldTSDTNORTHBULDYHAEMCNSMELCNEWI have looked at the BOL String functions and cannot find an obvious solution. Is there one?ThanksDan |
|
X002548
Not Just a Number
15586 Posts |
|
DLTaylor
Posting Yak Master
136 Posts |
Posted - 2007-10-18 : 12:06:00
|
Thanks for the pointerFor some reason I couldn’t find POSINDEX in BOL... but using your pointer I found the CHARINDEX function which managed to work for me...Not quite how I imagined but here is my code...select SUBSTRING(LEFT(Field1, CHARINDEX(' - ', Field1) - 1), 9, 200)fromTableName Thanks for your help.Dan |
 |
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2007-10-18 : 12:10:48
|
> Did you see POSINDEX in BOL?db2, brett?or did you mean PATINDEX?_______________________________________________Causing trouble since 1980blog: http://weblogs.sqlteam.com/mladenpSSMS Add-in that does a few things: www.ssmstoolspack.com |
 |
|
|
|
|