Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Email Alias Lookup

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-03-01 : 08:51:58
Eric writes "I am importing a list of email addresses and aliased email addresses from an old unix system. The flatfile from unix is set up as follows:


alias: email_address

Both alias and email_address are valid addresses to send to for a given user. The user may have multiple aliases and the chain of aliases can be of any length. Take the following for example:


robert.jones: rjones
rjones: bob.jones
bjones: bob.jones
bob.jones: bobj


With the above (fake) subset of the alias table, all addresses are all aliases for the same user.
I need to be able to do the following: Given any valid email address, return all valid email addresses for the user. So, if I am given robert.jones, I need returned back to me rjones, bob.jones, bobj, bjones, and robert.jones. I have created a table names aliases and have given it an identity field (pk), an alias field, and an address field. This is imported into SQL server using DTS. I tried several queries but have not gotten what I want. It looks like it may require recursion which I have never attempted in the SQL world. Any ideas?"

graz
Chief SQLTeam Crack Dealer

4149 Posts

Posted - 2002-03-01 : 08:51:58
These should point you in the right direction: http://www.sqlteam.com/SearchResults.asp?SearchTerms=tree
Go to Top of Page
   

- Advertisement -