Import XML File to SQL Table

Here is a brief example of importing an XML file into SQL Server table. This is accomplished by using the BULK option of OPENROWSET to load the file, and then utilizing the XQuery capabilities of SQL Server to parse the XML to normalized table format. This example requires SQL server 2005 or SQL Server 2008.

More Related Resource Links

Hi all, need some help here as am not the SQL guru or anything close. I need to write a stored procedure which will import data from a log file into a table in a Database. Right now, i have a log file that looks just like this and i wan to be able to get
the data into the appropriate fields in the a table (lets call it tbl_log). I have a service that is creating the log file and i want to be able to import the data into a table, so i need to be able to set the different directories dynamically since there
will be different logs in different directories.

I have one xls file which has 1.98 lacs rows. Whenever I try to import it in sql database table then I am getting following error to open OLE db connection.External table is not in the expected format.

I am a first time BCP user. I have an XML file that I need to import into a new table in SQL Server. This is using SQL Server 2008 and BCP version 10.50.16. I read through the documentation but I get 370,000 errors! (This is a very
large file). When I open the error log, I just see a bunch of question marks.
About this XML file: it does use a new line to delineate rows, however, it uses the space character to separate fields. So I'm not sure if that is what causes it to fail. The failure message is:
BCP copy in failed
I wish it were more descriptive. Is there a way to get a more detailed error message?
Otherwise, here is my command:
d:\SQL Tables\data>bcp Development.dbo.wbl_zSkywardEnrollment2 in zSkywardEnroll
ment.xml -fSE_format.fmt -m50 -eseErrorLog -b100 -t0x20 -T -F107
All of these files are in this same directory. I know it says to specify full file path, but since they're all in this same directory and also I saw another example where they didn't specify directories I thought this would suffice.
I have tried this without the format file also, doing it interactively but get same errors.
And I have tried this starting with row 1. I am curious which line should BCP start on? Line 1 of this XML starts with Schema and ElementType info. But on line 107 is where rs:data section

Hi,
I have Visio 2010 Premium. Am running SharePoint 2010 Enterprise.
I have created a workflow in SharePoint Designer 2010. I select the "Export to Visio" button. A VWI file is created.
In Visio 2010, I attempt to open the file. However, Visio reports that it cannot read the file.
Please advise.

MOD to windows movie maker
converter is one of the most efficient converting program for your to convert MOD file to windows movie maker compatible format—WMV, AVI, MPG so that you could import MOD to windows movie maker for editing MOD with WMM without difficulty.
People may encounter many problems about MOD and windows movie maker
•1. I have an Everio JVC hard disk drive (meaning no tape needed) and the Windows movie maker says it doesn't support "The file F:\SD_VIDEO\PRG003\MOV0CD MOD is not a supported file type, and it cannot be imported into Windows Movie Make".
•2. Hey I just got this video Camera with a hard driver build in, and it makes all the movie files in MOD files, but how do I convert them so I can put them into Windows Movie maker?
•3. I have MOD video files on an sd card that I am trying to open and edit with windows movie maker. It shows the video but there is no sound from the files. Please help.
The main reason for movie maker not being able to recognize MOD
A MOD video file is used by some models of Panasonic, JVC, Canon and perhaps other camcorders and windows movie maker does not support MOD. That is why you are having problems. Windows movie maker is quite friendly to WMV, AVI and MPG format.
MOD to windows movie maker converter is the best software to change MOD files extension for
importing MOD to windows movie maker
Ap

Hi there everyone,
Version: Windows Sharepoint Services 3.0 with Cumulative Update June 29, 2010 applied.
I am having issues importing an exported site into a different domain. I've overcome most of the issues and actually got most of the site to import, however, the import process get's stuck on import a Single File Web Page document from a document library.
I believe the original cause of this error is
http://support.microsoft.com/kb/980079
The issue I face now is, I already have a large number of .mht files in my document library which I do need to import into the test environment (or that I might need to restore in a DR scenario).
Does anyone have any information on either:
forcing the import commmand to "on error resume next" (ie. not stop processing when it encounters an error)
fixing the already corrupt .mht files in the database easily
The error text from the import command is:
Error: Could not process the file Documents/Application Deployment.mht as a Single File Web Page document.
at Microsoft.SharePoint.Library.SPRequest.CreateOrUpdateFileAndItem(String bstrUrl, String bstrWebRelativeUrl, Guid& docId, Object varDoc, Int32 docLength, Int32 exists, String bstrCreatedBy, String bstrModifiedBy, Int32 iCreatedByID, Int32 iModifiedByID, Int32 iVersion, Object varTimeCreated, Object varTimeLastModified, Object varProperties, String checkInComment, Int3

I'm trying to take the XML that is generated by a "Save As" from PPT 2007 and import that into SQL. My goal is to be able to capture the appropriate records for the presentation, slides, and images and have them stored and accessible.
When I try follow the directions found here: http://www.sql-server-performance.com/articles/dba/Loading_XML_data_into_SQL_Server_2008_p1.aspx
I run into a problem that the XML contains multiple namespaces.
Any help would be greatly appreciated!

I have a flat text file (comma delimited) that is essentially multiple files, each with its own format, combined into one file. The file is coming from an external software vendor so unfortunately we don't have much choice but to work with what
we are receiving.
Here is an example of what the file could look like:
Customer Data
CustID,FName,LName,PhNum,Email
12345,John,Smith,,jsmith@gmail.com
12346,Jane,Doe,8001111111,jdoe@hotmail.com
Customer Plan
CustID,PlanType,PlanName,PlanStart
12345,0,Plan1,01/01/2010
12345,2,PlanVis,01/01/2010
12346,3,PlanLf,04/01/2010
12346,0,Plan1,01/01/2010
Customer Payment
CustID,LastPayment,Amount
12345,09/01/2010,100.00
12346,05/01/2010,50.00
There is an empty line between each 'section' of data. I adapted a VB script I found online that can take the incoming file and save off each section as its own file so that each one can be separately imported, but this seems inefficient. I'm really
new to SSIS in general, but it seems like it shouldn't be that difficult to take the data, split it where there is an empty line, and then import each section into the appropriate SQL table.
Any ideas would be most welcome. Thanks!

I'm trying to parse a text file into a sql table. I have the code to parse the file and display it in a datatable but for the life of me I can't figure out how to import it into a sql table. All my previous experience has been with
csv files and with schema.ini files. This is new to me.
This is what the code to read the text file and display it in a datagridview:
Dim dtTest As DataTable
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
dtTest = New DataTable
DataGridView1.DataSource = dtTest.DefaultView
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim filename As String = "C:\Price.txt"
Dim lstValues As New List(Of String)
Try
Using sr As StreamReader = New StreamReader(filename)
While Not sr.EndOfStream
Dim splits As String()
splits = sr.ReadLine.Split(","c)
dtTest.Columns.Add(splits(1), GetType(String))
lstValues.Add(splits(2))
End While
End Using
Catch ex As Exception
End Try
dtTest.Rows.Add(lstValues.ToArray)
End Sub
This is what the data in the text file looks like:
DD/MM/YYYY HH:MM:SS,LAU4AB,245.35
DD/MM/YYYY HH:MM:SS,ROC06,123.45
DD/MM/YYYY HH:MM:SS,GRE033,87.5
The second item "LAU4AB is the column header for the first

I'm trying to take the XML that is generated by a "Save As" from PPT 2007 and import that into SQL. My goal is to be able to capture the appropriate records for the presentation, slides, and images and have them stored and accessible.
When I try follow the directions found here: http://www.sql-server-performance.com/articles/dba/Loading_XML_data_into_SQL_Server_2008_p1.aspx
I run into a problem that the XML contains multiple namespaces.
Any help would be greatly appreciated!

I need to insert some csv file data into sql server 2008. but there are multiple tables created in sql server and I need to check some conditions before data insertion and based on the condition value, sql script should insert the data in to specific table.
in other words I need to insert data from one csv file to different tables based on some condition.

is it possible? if yes then can anyone please give me an idea on how can we do that?