Jump to content

SQL Query that selects one word from a column many words


Recommended Posts

You can use charindex for ms sql.

 

You specify what your looking for as the first parameter and the string that you are searching in as the second parameter. If the first parameter exists in the second parameter, it will return the index where the string starts in the second parameter, else it will return 0 if not found in the second parameter.

 

e.g. CHARINDEX('cc', 'aa bb cc dd') will return 7 where as CHARINDEX('ee', 'aa bb cc dd') will return 0.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.