Link to home
Start Free TrialLog in
Avatar of Larry Brister
Larry BristerFlag for United States of America

asked on

XML Select "TYPE=" or Version=""

How can I take my code below and when there's no OrganizationalType  return this

<OrganizationalType  Type="NOType"/>

Instead of this
<OrganizationalType />
Select blah...blah...blah...,
debtOrganizationalType 'Debtors/Names/IndividualName/OrganizationalType'  
from  
   research.dbo.r_data_ucc where debtLastName Like 'B%'  
for xml path('Record'

Open in new window

Avatar of derekkromm
derekkromm
Flag of United States of America image

Select blah...blah...blah...,
isnull(debtOrganizationalType, 'NOType') 'Debtors/Names/IndividualName/OrganizationalType'  
from  
   research.dbo.r_data_ucc where debtLastName Like 'B%'  
for xml path('Record'
Avatar of Larry Brister

ASKER

derekkromm
That returns
<OrganizationalType>NOType</OrganizationalType>

I need
<OrganizationalType  Type="NOType"/>

ASKER CERTIFIED SOLUTION
Avatar of derekkromm
derekkromm
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
YEAH!