Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase ««12

Return sepcifc data on query Expand / Collapse
Author
Message
Posted Thursday, June 27, 2013 9:17 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Wednesday, April 30, 2014 2:36 PM
Points: 12, 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.
Post #1468220
Posted Thursday, June 27, 2013 9:19 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Wednesday, April 30, 2014 2:36 PM
Points: 12, 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.
Post #1468221
Posted Thursday, June 27, 2013 9:39 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Yesterday @ 2:54 PM
Points: 13,228, Visits: 12,705
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 Moden's 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)
Post #1468233
« Prev Topic | Next Topic »

Add to briefcase ««12

Permissions Expand / Collapse