SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 XML import
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

kmslick
Starting Member

6 Posts

Posted - 05/20/2012 :  01:36:57  Show Profile  Reply with Quote
I have XML files that I need to import but I have not worked with XML much. Can someone help with the best approach/syntax? Also, the XML input files are 3GB in size.

XML format:
<row id="2">
<account_num>41</account_num>
<log_header_id>1999999798</log_header_id>
<sequence_no>1</sequence_no>
<value>/957 ST GEORGE BARBER ROAD/./DAVIDSONVILLE MD</value>
<status>A</status>
<last_maintenance_dt>2012-05-17 11:21:17.123</last_maintenance_dt>
<last_maintenance_userid>rglacken</last_maintenance_userid>
<LOG_DETAIL_lock>0</LOG_DETAIL_lock>
<value_1>./957 ST GEORGE BARBER ROAD/./DAVIDSONVILLE MD 21035</value_1>
<value_2></value_2>
<value_3></value_3>
<value_4></value_4>
<repetition_no>0</repetition_no>
<binary_format></binary_format>
<value_binary></value_binary>
<value_text></value_text>
</row>

visakh16
Very Important crosS Applying yaK Herder

India
47069 Posts

Posted - 05/20/2012 :  11:04:59  Show Profile  Reply with Quote
by import do you mean storing XML as it is? or do you mean shredding data from XML onto table fields like account_num,sequence_no etc?


------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
47069 Posts

Posted - 05/20/2012 :  11:20:08  Show Profile  Reply with Quote
if former look at this

http://msdn.microsoft.com/en-us/library/ms191184.aspx

if latter have a look at nodes(),query(),value() functions in books online

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

kmslick
Starting Member

6 Posts

Posted - 05/20/2012 :  23:41:39  Show Profile  Reply with Quote
quote:
Originally posted by visakh16

if former look at this

http://msdn.microsoft.com/en-us/library/ms191184.aspx

if latter have a look at nodes(),query(),value() functions in books online

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/



I need to shred it and insert into a SQL table as varchar and numeric fields. Thanks for your help.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
47069 Posts

Posted - 05/21/2012 :  16:41:39  Show Profile  Reply with Quote
then make use of nodes() and value() functions

WHats table to which you want to insert. show an example and explain what value should populate which column in table.

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000