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
Solved

SubString Query

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

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Download ms sql express. 2 25
SQL Select in Access 2003 3 23
SQL View / Qtry 3 8
Get rid of the last Last comma and space in a SQL statement. 7 14
If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
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 SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

809 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