Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

SubString Query

Posted on 2007-03-27
1
Medium Priority
?
442 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 75

Accepted Solution

by:
Anthony Perkins earned 2000 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
It is possible to export the data of a SQL Table in SSMS and generate INSERT statements. It's neatly tucked away in the generate scripts option of a database.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
Introduction to Processes

670 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