---
title: "SQL INSTR Function Real Usage"
description: "Syntax for INSTR function to extract index of position of sub-string from main string."
url: https://srinimf.com/2012/07/01/sql-instr-function-usage/
date: 2012-07-01
modified: 2026-10-10
author: "Srini"
image: https://i0.wp.com/srinimf.com/wp-content/uploads/2012/07/sql-instring-functions.jpg?fit=1200%2C700&ssl=1
categories: ["Data Warehousing & Tools"]
tags: ["SQL INSTR Function"]
type: post
lang: en
---

# SQL INSTR Function Real Usage

In terms of SQL, function means, definitely it returns result. Where as in the WHERE clause we use relational operators (>, <, =, LE, GE) etc. In the where clause, we may or may not get the result. 

Related[How to Use DIGITS function to get Digits from Decimal Column Value](https://srinimf.com/2017/07/19/db2-digitis-function-example/)

If we [want to](https://srinimf.com/2016/02/09/want-to-excel-in-ims-dc-programming-read-this/) find a certain character position in a String, we use INSTR function. Look at the syntax.

Related in Reverse order in Python](https://srinimf.com/2021/11/20/python-program-to-print-name-in-reverse-order/)

## Syntax for INSTR()

```
INSTR(Colname, character to which position we need,start position,which char you need)

For example:

 Table Emp-name
 ------
 Rani Raghav
 -------- 

"Rani Raghav" - I want to find position for first space.

Select INSTR(name, ' ', 1, 1) from emp;

The result will be - 5.
```

Related

- [How to Create SQL UDF Quickly](https://srinimf.com/2017/10/12/spilt-string-sql-logic-to-create-function/)DateOctober 12, 2017
- [DB2: How to Create Function-Best example](https://srinimf.com/2015/11/17/create-function-in-db2-best-example/)DateNovember 17, 2015
- [DB2: Zero Matching Rows Then Which Value Function Returns](https://srinimf.com/2015/02/12/db2-aggregate-functionsno-row-found/)DateFebruary 12, 2015

### Share this:

-
- [Tweet](https://twitter.com/share)
- [![](https://i0.wp.com/assets.pinterest.com/images/pidgets/pinit_fg_en_rect_gray_20.png)](https://www.pinterest.com/pin/create/link/?url=https%3A%2F%2Fsrinimf.com%2F2012%2F07%2F01%2Fsql-instr-function-usage%2F&media=https%3A%2F%2Fi0.wp.com%2Fsrinimf.com%2Fwp-content%2Fuploads%2F2012%2F07%2Fsql-instring-functions.jpg%3Ffit%3D1200%252C700%26ssl%3D1&description=SQL%20INSTR%20Function%20Real%20Usage)
-
- [Share on Tumblr](https://www.tumblr.com/share)
- [Share on WhatsApp (Opens in new window) WhatsApp](https://srinimf.com/2012/07/01/sql-instr-function-usage/?share=jetpack-whatsapp)
- [More](#)
-

- [Print (Opens in new window) Print](https://srinimf.com/2012/07/01/sql-instr-function-usage/?share=print)
- [Share on Reddit (Opens in new window) Reddit](https://srinimf.com/2012/07/01/sql-instr-function-usage/?share=reddit)
- [Share on Telegram (Opens in new window) Telegram](https://srinimf.com/2012/07/01/sql-instr-function-usage/?share=telegram)
- [Email a link to a friend (Opens in new window) Email](mailto:?subject=%5BShared%20Post%5D%20SQL%20INSTR%20Function%20Real%20Usage&body=https%3A%2F%2Fsrinimf.com%2F2012%2F07%2F01%2Fsql-instr-function-usage%2F&share=email)
-

### Like this:

Like Loading…
