Solved

XML Select "TYPE=" or Version=""

Posted on 2011-03-04
4
255 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
  • 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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

Suggested Solutions

In this article I will describe the Copy Database Wizard 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.
JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
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…
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed

778 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