Closed. This question needs to be more focused . It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post .
Closed 10 hours ago.
Improve this question
How do I evaluate if any string (the first component of an email address [name] field) has an equivalent email followed by a non alphanumeric character. How do I say concat[name] plus all possible non alpha numeric characters and see if exists or in or like the email in the master table.
My data (local table).
| Email | email_id | name | domain | ext |
| ------------ | ------------ | ------------ | ------------ | ------------ |
| email protected(https://stackoverflow.com/cdn-cgi/l/email-protection) | 1234 | HelloWorld | gmail | com |
| email protected(https://stackoverflow.com/cdn-cgi/l/email-protection) | 678 | jon.smithII | nyu | edu |
master table
| Email | id |
| [email protected] | 1234 |
| [email protected] | 1235 |
| [email protected] | 1336 |
| [email protected] | 1237 |
1条答案
按热度按时间t9aqgxwy1#
It's really helpful if you provide the DDL/DML, in an easy to reproduce format.
Here we're using the string manipulation functions
LEFT
,SUBSTRING
,PATINDEX
,REVERSE
andCHARINDEX
to slice and dice the emails up. https://learn.microsoft.com/en-us/sql/t-sql/functions/string-functions-transact-sql?view=sql-server-ver16 .I've assumed A-Z a-z and 0-9 covers the alpha-numeric range you wanted.
This is probably a job for your favorite ETL tool, but could work in a pinch. You may want to consider storing the results rather than regenerating them all the time.