Solved

SubString Query

Posted on 2007-03-27
1
426 Views
Last Modified: 2010-06-21
Hi there,

I am trying to retrieve a substring from a varchar column in the database. The column is used for storing email addresses and I am trying to sort the query by the domain names in the email address column.

Is there a charAt function in SQL Server I could use?

Anyone have the code to extract the domain name from the email address using sql server?
0
Comment
Question by:quanmac
1 Comment
 
LVL 75

Accepted Solution

by:
Anthony Perkins earned 500 total points
ID: 18803992
>>Is there a charAt function in SQL Server I could use?<<
CHARINDEX() is what you are looking for.

ORDER BY SUBSTRING(YourColumnName, CHARINDEX('@', YourColumnName) + 1, 256)
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
This article describes how to use the timestamp of existing data in a database to allow Tableau to calculate the prior work day instead of relying on case statements or if statements to calculate the days of the week.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.
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…

758 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

21 Experts available now in Live!

Get 1:1 Help Now