• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 223
  • Last Modified:

SQL String functions

If I have an email address xxx.yyy@xxx.com, how do I use the SQL string functions to return the first part of the email address before the @. (xxx.yyy). Its not enough to use left() as the email address can vary in length.
0
thehaze
Asked:
thehaze
1 Solution
 
Chris MangusDatabase AdministratorCommented:
Try:

Select Left(myEmailAddress, Patindex('%@%', myEmailAddress) -1) From myTable

This scriptlet will fail if the @ is missing from an email address
0
 
thehazeAuthor Commented:
Just what I was looking for.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

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