SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Return sepcifc data on query


Return sepcifc data on query

Author
Message
bquintana
bquintana
Grasshopper
Grasshopper (18 reputation)Grasshopper (18 reputation)Grasshopper (18 reputation)Grasshopper (18 reputation)Grasshopper (18 reputation)Grasshopper (18 reputation)Grasshopper (18 reputation)Grasshopper (18 reputation)

Group: General Forum Members
Points: 18 Visits: 40
Steve Jones - SSC Editor (6/26/2013)
You'll have to provide mode DDL and sample data. Also, how do you define an internal address?


Any internal email will not have the @provider.com.
bquintana
bquintana
Grasshopper
Grasshopper (18 reputation)Grasshopper (18 reputation)Grasshopper (18 reputation)Grasshopper (18 reputation)Grasshopper (18 reputation)Grasshopper (18 reputation)Grasshopper (18 reputation)Grasshopper (18 reputation)

Group: General Forum Members
Points: 18 Visits: 40
Sean Lange (6/27/2013)
See if something like this will get you started. Please notice how I posted ddl and sample data in a consumable format.


if OBJECT_ID('tempdb..#Something') is not null
drop table #Something

create table #Something
(
Ticket int,
contacts varchar(100)
)

insert #Something
select 4368642, 'Customer Support, Customer45@hotmail.com' union all
select 4368640, 's_prod_i3admin, s_prod_i3admin, Customer12@yahoo.com' union all
select 4368023, '1234Customer@msn.com'

select *
from #Something s
cross apply dbo.DelimitedSplit8K(s.contacts, ',') x
where CHARINDEX('@', x.Item) > 0



You can find the code for the DelimitedSplit8K function by following the link in my signature about splitting strings.



Ok, I really appreciate the direction. Thanks again for you patience and help.
Sean Lange
Sean Lange
One Orange Chip
One Orange Chip (27K reputation)One Orange Chip (27K reputation)One Orange Chip (27K reputation)One Orange Chip (27K reputation)One Orange Chip (27K reputation)One Orange Chip (27K reputation)One Orange Chip (27K reputation)One Orange Chip (27K reputation)

Group: General Forum Members
Points: 27412 Visits: 17557
You are welcome. Hope that helps get you going.

_______________________________________________________________

Need help? Help us help you.

Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

Need to split a string? Try Jeff Modens splitter.

Cross Tabs and Pivots, Part 1 – Converting Rows to Columns
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs
Understanding and Using APPLY (Part 1)
Understanding and Using APPLY (Part 2)
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search