Showing posts with label datasets. Show all posts
Showing posts with label datasets. Show all posts

Wednesday, March 28, 2012

How can I read data from a dataset directly into a sql database table using IS ?

Hi !

I've got a series of datasets which I need to transfer directly into a set of database tables. I can't find any tools in the IS for doing this, except using a XML source, which means I have to use a temporary file, which I of course won't have.

What am I missing ? What is the way to do this ?

Any help appreciated !Where do these "datasets" reside?

-Jamie|||They reside in .net assemblies. The data comes from a system where we can generate .net "proxies", that is ordinary .net assemblies, where the data is delivered as typed datasets.

Monday, March 12, 2012

How can I join information from different datasets?

I want to know how to join information that is in 2 different datasets into a single table.
Thanks
P.S. Also having problems with data driven subscription, it simply won't connect to the database with subscribers, always getting the logon error.

Probably not the answer you're looking for, but this functionality isn't supported in either 2000 or 2005 -- You'll basically have to do the (join) work inside a SQL sproc/view and then pull the results into a single dataset

Sorry...

|||Thank you for your answer.
P.S. Do you have any guidelines for me for the second problem? Also posted it in another thread: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=124613&SiteID=1

Sunday, February 19, 2012

How can I generate xsd files from existing tables?

I would like to generate xml schema files for my data model for later use with testing tools such as ndbunit. I realize that Visual Studio datasets can be used to do this, however, Visual Studio does not automatically determine table realtionships. I do not want to manually specify these relationships. I also do not have the luxury of using TeamServer for DB professionals. The Database Diagrams feature of SQL Server Management Studio seems capable of determining the table relationships on its own. However, I don't see any way to simply export a databse diagram to an xml schema definition. I realize I could write code to do this myself using the nice APIs under the Microsoft.Sqlserver.management and System.xml namespace, but I'm trying to avoid doing this. Is there a way to do this with SQL Server Management Studio?

Would something like this work for you? It's not technically a "right-click" operation, but it does generate the schema:

SELECT *
FROM Customers
FOR XML RAW('Customer'), XMLSCHEMA('urn:example.com')
-

<xsd:schema targetNamespace="urn:example.com"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:sqltypes=
"http://schemas.microsoft.com/sqlserver/2004/sqltypes"
elementFormDefault="qualified">
<xsd:import namespace=
"http://schemas.microsoft.com/sqlserver/2004/sqltypes" />
<xsd:element name="Customer">
...
</xsd:element>
</xsd:schema>
<Customer xmlns="urn:example.com" CustomerID="ALFKI" CompanyName="Alfreds Futterkiste" ContactName="Maria Anders" ContactTitle="Sales Representative" Address="Obere Str. 57" City="Berlin" PostalCode="12209" Country="Germany" Phone="030-0074321" Fax="030-0076545" />
...

|||Thanks for the suggestion. This will work fine for my needs!|||

I should be a little clearer. If you want just the schema for the table, select something that returns all nulls or an empty set, but make sure you use the XMLSCHEMA option. You can find more about that in Books Online - past this in the "URL" bar of BOL:

ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/udb9/html/04b35145-1cca-45f4-9eb7-990abf2e647d.htm

Buck

|||When using the XMLSCHEMA option, I cannot seem to get the generated schema to contain foreign key constraints. I looked over the MSDN documentation, but I have not found any specific options related to this. Is this a limitation or am I simply missing some parameters that will cause the contraints to be included?|||You're not missing anything - it definitely won't do that. I would suggest you live.com search for a "database documenter" script (there are tons out there) and add the XMLSCHEMA to the end of one of those. That should give you a database design in an XML document.