Solved

SQL String functions

Posted on 2007-11-26
2
208 Views
Last Modified: 2010-05-18
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
Comment
Question by:thehaze
2 Comments
 
LVL 17

Accepted Solution

by:
Chris Mangus earned 250 total points
ID: 20351491
Try:

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

This scriptlet will fail if the @ is missing from an email address
0
 

Author Closing Comment

by:thehaze
ID: 31411022
Just what I was looking for.
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now