I have a requirement where I have to write a SQL query to produce seperate records if my column contains more than one value.
Like
select * 
from tblMachine 
where pkey = 1;
This is the result I got:
1 C000279   EMAIL PIC       xx@yy.com;yy@xx.com
I have a requirement to write a query so that it will produce seperate record if there are more than 1 value in the email column.
Like
1 C000279   EMAIL PIC       xx@yy.com
1 C000279   EMAIL PIC       yy@xx.com
Is this possible in SQL Server 2008?
@GurV, this is my exact query
select distinct c.PKEY [Customer Code],
c.NAME [Customer Name],
mi.MODEL [Machine #],
(select Split.a.value('.','varchar(100)') email
from 
    (select       
        cast('<x>' + replace(m.CONTACT_EMAIL,';','</x><x>')+'</x>' as XML) as x
    from tblMachineContact m
    where mi.PKEY=m.MAC_PKEY and m.CONTACT_CATEGORY_PKEY in ('PC'))t
cross apply x.nodes ('/x') as Split(a)) [Customer Email]
from tblMachine mi
inner join tblCustomers on m.CUST_PKEY=c.PKEY
where mi.STATUS='A'
 
    
 
    