Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: SQL Server
Expertise: Beginner
Jul 16, 1999

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
----------
----------- 
1
1
1
1
1
1
0
0
0
0
0
0
DevX Pro
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date