Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search specified spot in string for specified character

Status
Not open for further replies.

mkallover

Programmer
Joined
Feb 6, 2008
Messages
88
Location
US
I'm trying to figure out how I can search a field in a table for a specific character (in this case a 'P') in a specific position (second from the end.)

I've looked at CHARINDEX but I don't think that will get me what I need. I'm thinking maybe I'll have to use a combination of things.

Any ideas?
 


Hi,
[tt]
Where MID([Your Field],Len([Your Field])-1,1)='P'
[/tt]


Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Thanks Skip.

What is the difference between MID and SUBSTRING? After posting this I managed to find some info on SUBSTRING and it look like the same type of function.
 
SUBSTRING is for SQL Server
 


Also Oracle & DB2 use SUBSTR.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top