Skip to main content

Command Palette

Search for a command to run...

Using INSTR in BigQuery

Updated
1 min read
Using INSTR in BigQuery
C

Senior Data Engineer • Contractor / Freelancer • GCP & AWS Certified

If you ever need to do something different based on the existence of a particular substring in hashtag#BigQuery, take a look at the INSTR function.

It returns the 1-based index of the first occurrence of a substring (1 or more characters) in another STRING. The function returns 0 if the substring was not found.

There's also a possibility to specify at what position to start the search (like in good old Excel) and which occurrence to get.

Found it useful? Subscribe to my Analytics newsletter at notjustsql.com.

Practical SQL

Part 1 of 50

Short, practical posts on SQL and BigQuery — from core language features to advanced query patterns. A reference for data practitioners at every level.

More from this blog

D

Datawise — SQL, BigQuery & Python for Data Engineers

205 posts

Data Engineer with a passion for transforming complex data landscapes into insightful stories. Here on my blog, I share insights, challenges, and the ever-evolving dance of technology and business.