Click here to Skip to main content
15,886,919 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi all,

I have created a form using classic ASP. In that am getting all the details like name,address,designation,email etc.

when the user click the submit button then i should compare the domain name of the email id with the emailid's in database.

My problem is , i want to know how to write a query to get only the domain name from email id and compare it with existing email id's..

I have no idea... Please share if you have any solution for this..

Thanks in advance.
Posted

specific Internet identifier that contains a
locally interpreted string followed by the at-sign character ("@",
ASCII value 64) followed by an Internet domain.

So everything after the @ is the domain...
 
Share this answer
 
To add to solution 1, study the following link which will help you to construct the sql statement:
T-SQL: RIGHT, LEFT, SUBSTRING and CHARINDEX Functions[^]
 
Share this answer
 
Using this below Query you will be able to get domain name from the email ID

SQL
DECLARE @ID AS NVARCHAR(30)='Help@Codeproject.Com'

SELECT SUBSTRING(@ID,CHARINDEX('@',@ID)+1,LEN(@ID))

OR

SELECT RIGHT(@ID,(LEN(@ID)-CHARINDEX('@',@ID)))
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900