473,385 Members | 1,582 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Find website from email address

Hi,

I have 2 fields in a database: 'email' and 'website'.

In the majority of cases, the website field is not populated even though the
email address is. In 90% of cases, the website will be 'www.' followed by
whatever is after the '@' symbol in the email address.

Would anyone be able to help me with the SQL that would take whatever is
after the '@' sign in the email address, add it to 'www.' and populate the
'website' field?

Thanks!
Jul 4 '07 #1
3 3171
Would anyone be able to help me with the SQL that would take whatever
is after the '@' sign in the email address, add it to 'www.' and
populate the 'website' field?
UPDATE yourtable
SET Site = SUBSTRING(yourtable.email, CHARINDEX('@', yourtable.email) + 1,
LEN(yourtable.email) - CHARINDEX('@', yourtable.email))

--
PBsoft di Gabriele Bertolucci
www.pbsoft.it
skype:pbsoftsolution
Jul 4 '07 #2
Would anyone be able to help me with the SQL that would take whatever is
after the '@' sign in the email address, add it to 'www.' and populate the
'website' field?
Here's one method:

UPDATE dbo.MyTable
SET website =
CASE WHEN CHARINDEX('@', email) 0 AND CHARINDEX('@', email) + 1 <
LEN(email) THEN
'www.' + SUBSTRING(email, CHARINDEX('@', email) + 1, 255)
ELSE
website
END
WHERE
website IS NULL OR
website = ''

--
Hope this helps.

Dan Guzman
SQL Server MVP

"Mintyman" <mi******@ntlworld.comwrote in message
news:f6*******************@news.demon.co.uk...
Hi,

I have 2 fields in a database: 'email' and 'website'.

In the majority of cases, the website field is not populated even though
the email address is. In 90% of cases, the website will be 'www.' followed
by whatever is after the '@' symbol in the email address.

Would anyone be able to help me with the SQL that would take whatever is
after the '@' sign in the email address, add it to 'www.' and populate the
'website' field?

Thanks!
Jul 4 '07 #3
Cheers guys! Much appreciated :o)

"Mintyman" <mi******@ntlworld.comwrote in message
news:f6*******************@news.demon.co.uk...
Hi,

I have 2 fields in a database: 'email' and 'website'.

In the majority of cases, the website field is not populated even though
the email address is. In 90% of cases, the website will be 'www.' followed
by whatever is after the '@' symbol in the email address.

Would anyone be able to help me with the SQL that would take whatever is
after the '@' sign in the email address, add it to 'www.' and populate the
'website' field?

Thanks!

Jul 4 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: john Q | last post by:
I found a PHP based email obfuscator for use in websites, where the source HTML (PHP, actually) file doesn't contain the actual email address in the Mailto tag, but generates it and that...
13
by: Peter Chant | last post by:
I'm considering setting a website up for a club. I do not plan the contents to be for public consumption, but on the other hand I'm not going to have anything on there that is confidential, that...
16
by: nmdc69 | last post by:
Hi folks, Is there a simple way to log IP's without CGI? I need to log the IP's of the visitors to a website I run. I used to have a CGI script but there's no CGI on the server I'm using now....
2
by: crferguson | last post by:
I'm having a really odd issue. Recently my company has upgraded our data server. For a couple of months I'm having to host two versions of the same website on our webserver until the new data...
1
by: selvamcbe | last post by:
sir I have a problem with installtion of phpbb 2 Forum in my website... I am having a website named http://www.clickonlinejobs.com Also i plan to include forum with it.So i have added my forum in...
4
by: Karl | last post by:
Hi, I wonder if anyone could explain some options for getting the location of a visitor of a website? For instance if someone from the UK visit a website designed for US citizens, how do I...
1
by: capturedspirit | last post by:
I am new to PHP and only know the very basics of website design etc. I would like to put a form on a website, were people can fill in their details if they want someone to get in contact with...
11
by: AAaron123 | last post by:
I have an vs2008 app that generates a website. I have a vs2008 app that uses the webbrowser and does this: WebBrowser1.Navigate(New Uri(address)) the address is: ...
21
by: =?ISO-8859-1?Q?Fad=A5?= | last post by:
Hello guys, I want to do kinda of an A/B split testing on a website I run. I just created a new version but I need to keep both version running and see which one will perform better. First, I'm...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.