patternMinor
CHARINDEX equivalent in DB2
Viewed 0 times
equivalentcharindexdb2
Problem
I am trying to select the domain from the column where I have email addresses.
For example, I have a table email_table and a column email with email addresses as below.
Expected result
Here is the query I tried with CHARINDEX that works in SQL Server but not in DB2.
For example, I have a table email_table and a column email with email addresses as below.
johndoe@gmail.com
jhefid@yahoo.com
ipw@gmx.comExpected result
gmail.com
yahoo.com
gmx.comHere is the query I tried with CHARINDEX that works in SQL Server but not in DB2.
select CHARINDEX('@', email) from email_tableSolution
It's
Here is the complete description of it with example.
Thanks!
LOCATE (in DB2) which is equivalent to CHARINDEX in SQL Server.Here is the complete description of it with example.
Thanks!
Context
StackExchange Database Administrators Q#243145, answer score: 3
Revisions (0)
No revisions yet.