Solved

SubString Query

Posted on 2007-03-27
1
431 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

Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

Question has a verified solution.

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

This is about my first experience with programming Arduino.
Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

910 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

20 Experts available now in Live!

Get 1:1 Help Now