Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
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.
You guys have helped me many times in the past; for that thanks. I am hopeing you can help me out again. I know is this simple and I've done it before, but for the life of me, I can't remember.This is the problem.I have a table called junk_senders with a column named junk_senders.This table contains email address from anyone that sends me spam.I would like to start blocking entire domains instead of individial email addresses. I would like to remove everything left of the @ symbol including the symbol. For example: 123@123.com would be trimed to 123.com.So I guess I have to search the string for the @ symbol add one and left trim everything. At least that is what my fuzzy logic tells me.Does anyone have any suggestions or examples I can look at.ThanksJerry
byrmol
Shed Building SQL Farmer
1591 Posts
Posted - 2003-07-03 : 20:59:00
Jerry,The help file that comes with SQL Server has all the information you need. It is commonly referred to as BOL (Books On Line).
--There are many ways to do thisDECLARE @Data VARCHAR(50)SET @Data = '123@123.com'SELECT RIGHT(@Data, LEN(@Data)-CHARINDEX('@',@Data))SELECT SUBSTRING(@Data, CHARINDEX('@',@Data)+1, LEN(@Data))
Look up all the keywords in BOL for more info...DavidM"SQL-3 is an abomination.."
demonbane
Starting Member
10 Posts
Posted - 2003-07-04 : 12:14:14
Thank you byrmol, that is what I needed. Now I just wish outlook's junk sender spam filter would have an odbc connetion to my database. Then things would be great.Anyways, thanks for helping me with my personal little query. ThanksJerry