Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

combine two fields 1

Status
Not open for further replies.

saintedmunds

Technical User
Apr 7, 2006
78
0
0
GB
Hi

I have a table with 3 fields ContactID Email Email2

I would like to get an SP to return the following

ContactID Email
23 me@me.com;you@you.com

but if they dont have a second email then just return

ContactID Email
47 xx@xx.com

I'm really not sure how to achieve this so any help would be great.

Cheers
 
Code:
SELECT ContactId,
       eMail+CASE WHEN ISNULL(eMail2,'') = ''
                       THEN ''
                  ELSE ';'+eMail2 END AS Email
FROM YourTable

not tested

Borislav Borissov
VFP9 SP1, SQL Server 2000/2005.
Microsoft MVP VFP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top