0
What is the difference between SUBSTR and CHARINDEX in the SQL Server?

Open 1 Answers 94 Views Technology
What is the difference between SUBSTR and CHARINDEX in the SQL Server?

1 Answer

0

What is the difference between SUBSTR and CHARINDEX in the SQL Server?

The SUBSTR function is used to return specific portion of string in a given string. But, CHARINDEX function gives character position in a given specified string.

SUBSTRING('Smiley',1,3)

Gives result as Smi

CHARINDEX('i', 'Smiley',1)

Gives 3 as result as I appears in 3rd position of the string

by (54.6k points)
...