Solved

DataSet Usage In SQL statements

Posted on 2004-08-02
3
190 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 500 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

Guide to Performance: Optimization & Monitoring

Nowadays, monitoring is a mixture of tools, systems, and codes—making it a very complex process. And with this complexity, comes variables for failure. Get DZone’s new Guide to Performance to learn how to proactively find these variables and solve them before a disruption occurs.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Powershell error using sql agent job 24 41
VM SQL server license. 1 67
T-SQL: need to reset a declared variable 4 33
Sql server query 8 21
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…
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.

752 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