Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

DataSet Usage In SQL statements

Posted on 2004-08-02
3
Medium Priority
?
192 Views
Last Modified: 2006-11-17
Hello,

so I have a database that contain's a table called accounts. The table's schema is:

ID              Username            Password


I also have an XML file which lists a bunch of ID's in it;
i.e.
<account>
 ID = "dasdfds"
</account>
<account>
 ID = "asdfda"
</account>

Thus the xml file contains a bunch of ID's that I gather into a dataset, or datatable. My question is whether there is an easy way with SQL or MSSQL to acquire all the row's in the "accounts" table whose ID colum matches the ID values in the XML dataset?

Any help on this would be greatly appreciated :)

thanks
0
Comment
Question by:simsingh
[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
3 Comments
 
LVL 75

Accepted Solution

by:
Anthony Perkins earned 1500 total points
ID: 11698007
If that was a well-formed Xml document you could OpenXml, unfortunately that is not a well formed Xml document.  Perhaps you can change it as follows:

<accounts>
      <account ID = "dasdfds"/>
      <account ID = "asdfda"/>
</accounts>

In which case, it would be trivial.

0
 

Author Comment

by:simsingh
ID: 11698688
yah but the reason I want tha tis because my XML file contains certain accounts that I want to access at a certain time...so if I can somehow get all those ID's from my database table ithat would be great :)
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 11698718
As I said, if it is a well formed Xml document it is easy.  So do you have a well formed Xml document, so that I can give you some sample code using OpenXml?
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
An alternative to the "For XML" way of pivoting and concatenating result sets into strings, and an easy introduction to "common table expressions" (CTEs). Being someone who is always looking for alternatives to "work your data", I came across this …
Via a live example, show how to shrink a transaction log file down to a reasonable size.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

705 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