Solved

DataSet Usage In SQL statements

Posted on 2004-08-02
3
179 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
  • 2
3 Comments
 
LVL 75

Accepted Solution

by:
Anthony Perkins earned 500 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

772 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now