SQL Substring searches

Question:
How do you select all entries that contain a certain substring? Is there a function like InStr() in VB?

Answer:
Yes, Check out the charindex function which will Return the number of the position the charcter searched for occupies in the searched for expression. Try this in Pubs:

select charindex("B", title_id) from titleauthor--------------------- 111111000000

devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist