Solved

XML Select "TYPE=" or Version=""

Posted on 2011-03-04
4
256 Views
Last Modified: 2012-05-11
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

0
Comment
Question by:lrbrister
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 15

Expert Comment

by:derekkromm
ID: 35038318
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'
0
 

Author Comment

by:lrbrister
ID: 35038364
derekkromm
That returns
<OrganizationalType>NOType</OrganizationalType>

I need
<OrganizationalType  Type="NOType"/>

0
 
LVL 15

Accepted Solution

by:
derekkromm earned 500 total points
ID: 35038378
isnull(debtOrganizationalType, 'NOType') 'Debtors/Names/IndividualName/OrganizationalType/@Type'  
0
 

Author Closing Comment

by:lrbrister
ID: 35038449
YEAH!
0

Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Can I skip a node in XML? 9 31
Return Rows as per Quantity of Columns Value In SQL 6 27
SQL eating up memory? 16 37
Converting Stored Procedure to SQL Statement 5 38
In this article I will describe the Detach & Attach method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question