[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 343
  • Last Modified:

VB.net SQL Instr Function

Hi

I am trying to run the following query against a SQL database in my VB.net app but am getting an error that
the Instr function is not recognized

Select Distinct [CustomerID] From [CHILDREN] Where Instr([Child Name],'Jayden') > 0
0
Murray Brown
Asked:
Murray Brown
  • 2
1 Solution
 
Russell FoxDatabase DeveloperCommented:
SQL uses CHARINDEX:
Select Distinct [CustomerID] From [CHILDREN] Where CHARINDEX('Jayden', [Child Name]) > 0

Open in new window

0
 
Russell FoxDatabase DeveloperCommented:
Or:
Select Distinct [CustomerID] From [CHILDREN] Where [Child Name] LIKE '%Jayden%'

Open in new window

0
 
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAuthor Commented:
Thanks very much
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now