March 5, 2004 at 10:32 am
What I need is an SQL equivalent of the VB Instr() function.
I'm looking for the occurance of a character in a string.
Need to know if it exists, and at which position in the string it's located.
Remembering the syntax for things, when I'm flipping back and forth between SQL, JavaScript, .Net, ASP, C and Oracle is going to drive me to nuts.
(And I swear the drive is getting shorter each day!)
Thanks in advance.
John
March 5, 2004 at 10:40 am
CharIndex(string to look for, string to search, [start position). For example:
Select CharIndex('A', 'ABC') will return 1. Remeber depending on your SQL server setup SQL Server may or may not be case sensitive.
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
March 5, 2004 at 12:37 pm
Jack is correct...or you can use the PATINDEX function if you need to use a wildcard in the search argument.
Steve
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply