Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 Import XML of table into SQL2005

Author  Topic 

Progress2007
Starting Member

17 Posts

Posted - 2008-08-26 : 02:33:34

Hello
I want to import XML format of a table into SQL 2005. How can i do this

For geneating XML of table i m using follwiong query :
[red[/red]
select * from ITC_Client for xml auto
OR
select * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='ITC_Client' FOR XML AUTO

Please tell me how to do this.

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-08-26 : 03:47:21
import from where? is your source a xml file?
Go to Top of Page

Progress2007
Starting Member

17 Posts

Posted - 2008-08-26 : 04:01:57
Yes Source is a XML file .
and the XML code is as follows.
<Schema name="Schema1" xmlns="urn:schemas-microsoft-com:xml-data" xmlns:dt="urn:schemas-microsoft-com:datatypes">
<ElementType name="ITC_Client" content="eltOnly" model="closed" order="many">
<element type="ModuleCode" />
<element type="LanguageCode" />
<element type="UserId" />
<element type="CategoryName" />
<element type="CategoryGroupCode" />
<element type="CategoryCode" />
<element type="CategoryLink" />
<element type="CategoryLinkNumber" />
<element type="CategoryOrder" />
<element type="CategoryInstructions" />
<element type="Description" />
<element type="Notes" />
<element type="BaseRate" />
<element type="Department" />
<element type="Contact" />
<element type="CompanyPhone" />
<element type="MobilePhone" />
<element type="Fax" />
<element type="Address1" />
<element type="Address2" />
<element type="City" />
<element type="ProvState" />
<element type="PostalCode" />
<element type="Country" />
<element type="Email" />
<element type="Active" />
<element type="ModificationDate" />
<element type="BudgetHours" />
<element type="BudgetAmount" />
<element type="ClientSince" />
<element type="IsDefaultRate" />
<element type="TrkIndexNumber" />
<element type="TrkCreationDate" />
<element type="CategoryBudgetHours" />
<element type="CategoryBudgetAmount" />
<element type="CategoryActualHours" />
<element type="CategoryActualAmount" />
<element type="DefaultTicketType" />
<element type="CategoryPONumber" />
<element type="CategoryInvoiceNumber" />
<element type="CategoryGLAccount" />
<element type="CategoryWorkOrderNumber" />
<element type="CategoryBillableHours" />
<element type="CategoryBillableAmount" />
<element type="CategoryWageCost" />
<element type="CategoryNumber" />
<element type="UserNumber" />
</ElementType>
<ElementType name="ModuleCode" content="textOnly" model="closed" dt:type="string" />
<ElementType name="LanguageCode" content="textOnly" model="closed" dt:type="string" />
<ElementType name="UserId" content="textOnly" model="closed" dt:type="string" />
<ElementType name="CategoryName" content="textOnly" model="closed" dt:type="string" />
<ElementType name="CategoryGroupCode" content="textOnly" model="closed" dt:type="string" />
<ElementType name="CategoryCode" content="textOnly" model="closed" dt:type="string" />
<ElementType name="CategoryLink" content="textOnly" model="closed" dt:type="string" />
<ElementType name="CategoryLinkNumber" content="textOnly" model="closed" dt:type="i4" />
<ElementType name="CategoryOrder" content="textOnly" model="closed" dt:type="i2" />
<ElementType name="CategoryInstructions" content="textOnly" model="closed" dt:type="string" />
<ElementType name="Description" content="textOnly" model="closed" dt:type="string" />
<ElementType name="Notes" content="textOnly" model="closed" dt:type="string" />
<ElementType name="BaseRate" content="textOnly" model="closed" dt:type="fixed.14.4" />
<ElementType name="Department" content="textOnly" model="closed" dt:type="string" />
<ElementType name="Contact" content="textOnly" model="closed" dt:type="string" />
<ElementType name="CompanyPhone" content="textOnly" model="closed" dt:type="string" />
<ElementType name="MobilePhone" content="textOnly" model="closed" dt:type="string" />
<ElementType name="Fax" content="textOnly" model="closed" dt:type="string" />
<ElementType name="Address1" content="textOnly" model="closed" dt:type="string" />
<ElementType name="Address2" content="textOnly" model="closed" dt:type="string" />
<ElementType name="City" content="textOnly" model="closed" dt:type="string" />
<ElementType name="ProvState" content="textOnly" model="closed" dt:type="string" />
<ElementType name="PostalCode" content="textOnly" model="closed" dt:type="string" />
<ElementType name="Country" content="textOnly" model="closed" dt:type="string" />
<ElementType name="Email" content="textOnly" model="closed" dt:type="string" />
<ElementType name="Active" content="textOnly" model="closed" dt:type="boolean" />
<ElementType name="ModificationDate" content="textOnly" model="closed" dt:type="dateTime" />
<ElementType name="BudgetHours" content="textOnly" model="closed" dt:type="r4" />
<ElementType name="BudgetAmount" content="textOnly" model="closed" dt:type="fixed.14.4" />
<ElementType name="ClientSince" content="textOnly" model="closed" dt:type="dateTime" />
<ElementType name="IsDefaultRate" content="textOnly" model="closed" dt:type="boolean" />
<ElementType name="TrkIndexNumber" content="textOnly" model="closed" dt:type="i4" />
<ElementType name="TrkCreationDate" content="textOnly" model="closed" dt:type="dateTime" />
<ElementType name="CategoryBudgetHours" content="textOnly" model="closed" dt:type="r4" />
<ElementType name="CategoryBudgetAmount" content="textOnly" model="closed" dt:type="fixed.14.4" />
<ElementType name="CategoryActualHours" content="textOnly" model="closed" dt:type="r4" />
<ElementType name="CategoryActualAmount" content="textOnly" model="closed" dt:type="fixed.14.4" />
<ElementType name="DefaultTicketType" content="textOnly" model="closed" dt:type="string" />
<ElementType name="CategoryPONumber" content="textOnly" model="closed" dt:type="string" />
<ElementType name="CategoryInvoiceNumber" content="textOnly" model="closed" dt:type="string" />
<ElementType name="CategoryGLAccount" content="textOnly" model="closed" dt:type="string" />
<ElementType name="CategoryWorkOrderNumber" content="textOnly" model="closed" dt:type="string" />
<ElementType name="CategoryBillableHours" content="textOnly" model="closed" dt:type="r4" />
<ElementType name="CategoryBillableAmount" content="textOnly" model="closed" dt:type="fixed.14.4" />
<ElementType name="CategoryWageCost" content="textOnly" model="closed" dt:type="fixed.14.4" />
<ElementType name="CategoryNumber" content="textOnly" model="closed" dt:type="i4" />
<ElementType name="UserNumber" content="textOnly" model="closed" dt:type="i4" />
</Schema>
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-08-26 : 04:22:23
Then have a look at below link
http://msdn.microsoft.com/en-us/library/ms191184.aspx
Go to Top of Page
   

- Advertisement -