Import XML Data To SQL Tables

Apr 2, 2008

Hi, I am trying to import an XML file to SQL tables using SSIS, Data Flow Task --> XML Source --> OLEDB destination.
I have both the XML file and its xsd file.

The extraction of the XML file output 5 tables (mc, r, i, bc and c, have relationship among them). My problem is that one of the tables is empty (table mc). I tried to add a "root" node to the XML file (the xsd file was modified too), and all 5 tables were populated correctly. Is there any other way to fix this problem without manually changing the XML file?

The XML file looks like this:

<mc MajCmd="Atlantic">
<r Region="East">
<i Installation_UIC="M00146" Installation_Name="Cherry Point">
<bc BC="111" BC_Title="Airways">
<c Restoration_Cost_C3="0.0000" Comment_Type="" Override_C_Rating="" Comment="" />
</bc>
</i>
</r>
</mc>

The xsd file looks like this:

<?xml version="1.0" encoding="utf-8"?>
<xschema id="NewDataSet" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urnchemas-microsoft-com:xml-msdata">
<xs:element name="mc">
<xs:complexType>
<xsequence>
<xs:element name="r" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xsequence>
<xs:element name="i" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xsequence>
<xs:element name="bc" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xsequence>
<xs:element name="c" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
</xs:complexType>
</xs:element>
..........
</xsequence>
<xs:attribute name="BC" type="xstring" />
<xs:attribute name="BC_Title" type="xstring" />
</xs:complexType>
</xs:element>
</xsequence>
<xs:attribute name="Installation_UIC" type="xstring" />
<xs:attribute name="Installation_Name" type="xstring" />
</xs:complexType>
</xs:element>
</xsequence>
<xs:attribute name="Region" type="xstring" />
</xs:complexType>
</xs:element>
</xsequence>
<xs:attribute name="MajCmd" type="xstring" />
</xs:complexType>
</xs:element>
<xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:UseCurrentLocale="true">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element ref="mc" />
</xs:choice>
</xs:complexType>
</xs:element>
</xschema>


Thanks!
ChaInn

View 2 Replies


ADVERTISEMENT

Data Import From Multiple Tables

Nov 7, 2005

Hi all,
I am a newbie to .NET and would appreciate all your valuble
suggestions. I have and issue were I am trying to import data from a
few selected columns  MS Access and a couple of columns in SQL
Server Table Y  and trying to populate another table X . Both
tables X and Y are in the same Database . I am wondering if I could
design a custom package for this task.

Ananth

View 2 Replies View Related

How To Import Data From AS400 Files To Sql 2005 Tables?

Apr 18, 2007

Hi All,

I want to Import data from AS400 to Sql2005. From the Sql Management studio I invoke the Import Data wizard. For the source I connect to the ISereis system and for the Destination I select the Sql2005 Database , When I go to the next step i.e select source tables I get the error
"An error has occured which the SQL Server Integration Wizard was not prepared to handle
No error message available,result codeB_E_CANTCANCEL(0*80040E15).(System.Data)" .After this I am unable to proceed further. I am using client Access tool to connect to ISereis

IBM DB2 UDB for isereis IBMDA400 OLE DB Provider





Regds,

Anu

View 2 Replies View Related

Import Data From Text File To Multiple Tables

Feb 8, 2008



I have a text file which contains the data that has to be inserted into multiple tables.The columnames of table 1 form the H1 follwed by Details D1,D1,D1...
The column names of table two form the H2 followed by details D2,D2,D2 so on and similarly for Table 3.
Am using a link server to the file directory and schema.ini which defines the column names fofr the text file

Is there any way of defining column names for more than one table through the schema.ini? or is there any other way through I can parse the text file contents to multiple tables?


Sample text file:
H1,JobDate,JobNumber,FileName,
D1,13/02/2008,asdf123,text1.txt
D1,13/02/2008,asdf123,text2.txt
D1,13/02/2008,asdf123,text3.txt

H2,PagesUsed,PagesPrinted,Pages emailed
D2,10,10,9
D2,1000,100,99
D2,50,22,93


Schema.Ini - defined for the first table

[LogConfig.txt]
Format=CSVDelimited
CharacterSet=ANSI
ColNameHeaders=true
Col1=JobDateText Width 20
Col2=JobNumberText Width 20
Col3=FileName Text Width 100

Hoe do i define the column names for the second table. All these contents are in a single text file and need to be parsed only thru sql.

Any help/suggestions are welcome..
Thanks a lot for taking time to read this.



View 1 Replies View Related

SQL Server 2012 :: XML Import Into Multiple Tables With Data Translation

Jul 17, 2014

I need to consume a live data feed from a golf tournament. And by consume, I really mean insert (merge) into our own SQL Server database on a regular intervals as a tournament progresses.This site didn't let me upload an XML file, but you can see a sample of the data feed here: URL....

I need to insert this data into 2 tables, Player_Holes and Player_Shots. But while doing the insert, I need to lookup several things such as our player ID match to theirs on an external_id against the players table. The shot types translation, and some other logic about the process overall.

The columns in my player_holes tables are: id, player_id, hole_id, round, shots (this is a total # of strokes) and date_created/date_modified.Shots table is similar: id, player_id, hole_id, round, shot_number, shot_type_id, club, distance, date_created/date_modified.

The only way I know how to do it, is inefficient. I would parse the XML in ColdFusion (please no comments on ColdFusion, that's what we use for webdev), and then loop over it and do inserts for each player, each hole for each round, and the shots would probably be separate for each hole.

It would be so much better and more efficient if I could do it in SQL directly. I've done some research and SQL Server Data Tools looks promising. I've never used it, so would have to learn, but also I'm not sure if that'd work in this application when we want to run is as a scheduled task every few minutes.

View 5 Replies View Related

SQL Server 2012 :: Unable To Link Data After Import From XML Into Tables

Aug 13, 2015

I'm pulling data from XML into tables, but I'm unsure how to link the data after it's imported. This example has names and tasks, and I can pull the data into two tables, but I can't find any way to link the task to the appropriate person. My person and task tables populate without issue, but there's nothing I can find to link the rows together. So in this example Test 1 would go to the first two Tasks and Test 2 would go to the second two work items.

DECLARE @XML TABLE (XMLData XML);
DECLARE @Person Table (Name NVARCHAR(50), Addresss NVARCHAR(50));
DECLARE @Task Table (Name NVARCHAR(50), Details NVARCHAR(50));
INSERT INTO @XML SELECT '
<process>
<header>
<Person><Name>Test1</Name><Address>123 main street</Address></Person>

[Code] .....

View 9 Replies View Related

Import Csv Data To Dbo.Tables Via CREATE TABLE &&amp; BUKL INSERT:How To Designate The Primary-Foreign Keys &&amp; Set Up Relationship?

Jan 28, 2008

Hi all,

I use the following 3 sets of sql code in SQL Server Management Studio Express (SSMSE) to import the csv data/files to 3 dbo.Tables via CREATE TABLE & BUKL INSERT operations:

-- ImportCSVprojects.sql --

USE ChemDatabase

GO

CREATE TABLE Projects

(

ProjectID int,

ProjectName nvarchar(25),

LabName nvarchar(25)

);

BULK INSERT dbo.Projects

FROM 'c:myfileProjects.csv'

WITH

(

FIELDTERMINATOR = ',',

ROWTERMINATOR = ''

)

GO
=======================================
-- ImportCSVsamples.sql --

USE ChemDatabase

GO

CREATE TABLE Samples

(

SampleID int,

SampleName nvarchar(25),

Matrix nvarchar(25),

SampleType nvarchar(25),

ChemGroup nvarchar(25),

ProjectID int

);

BULK INSERT dbo.Samples

FROM 'c:myfileSamples.csv'

WITH

(

FIELDTERMINATOR = ',',

ROWTERMINATOR = ''

)

GO
=========================================
-- ImportCSVtestResult.sql --

USE ChemDatabase

GO

CREATE TABLE TestResults

(

AnalyteID int,

AnalyteName nvarchar(25),

Result decimal(9,3),

UnitForConc nvarchar(25),

SampleID int

);

BULK INSERT dbo.TestResults

FROM 'c:myfileLabTests.csv'

WITH

(

FIELDTERMINATOR = ',',

ROWTERMINATOR = ''

)

GO

========================================
The 3 csv files were successfully imported into the ChemDatabase of my SSMSE.

2 questions to ask:
(1) How can I designate the Primary and Foreign Keys to these 3 dbo Tables?
Should I do this "designate" thing after the 3 dbo Tables are done or during the "Importing" period?
(2) How can I set up the relationships among these 3 dbo Tables?

Please help and advise.

Thanks in advance,
Scott Chang

View 6 Replies View Related

Integration Services :: Import Data From Multiple Excel Sheets To Multiple Tables Using SSIS?

Aug 25, 2015

I have an excel file that has multiple sheets and I need to import data from each separate sheet to a separate table using SSIS. 

E.g. Sheet A data should go to Table A and Sheet B data should go to Table B and so on. Is it possible to do this with out using script task.

View 6 Replies View Related

SQL Server Import And Export Wizard Fails To Import Data From A View To A Table

Feb 25, 2008

A view named "Viw_Labour_Cost_By_Service_Order_No" has been created and can be run successfully on the server.
I want to import the data which draws from the view to a table using SQL Server Import and Export Wizard.
However, when I run the wizard on the server, it gives me the following error message and stop on the step Setting Source Connection


Operation stopped...

- Initializing Data Flow Task (Success)

- Initializing Connections (Success)

- Setting SQL Command (Success)
- Setting Source Connection (Error)
Messages
Error 0xc020801c: Source - Viw_Labour_Cost_By_Service_Order_No [1]: SSIS Error Code DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER. The AcquireConnection method call to the connection manager "SourceConnectionOLEDB" failed with error code 0xC0014019. There may be error messages posted before this with more information on why the AcquireConnection method call failed.
(SQL Server Import and Export Wizard)

Exception from HRESULT: 0xC020801C (Microsoft.SqlServer.DTSPipelineWrap)


- Setting Destination Connection (Stopped)

- Validating (Stopped)

- Prepare for Execute (Stopped)

- Pre-execute (Stopped)

- Executing (Stopped)

- Copying to [NAV_CSG].[dbo].[Report_Labour_Cost_By_Service_Order_No] (Stopped)

- Post-execute (Stopped)

Does anyone encounter this problem before and know what is happening?

Thanks for kindly reply.

Best regards,
Calvin Lam

View 6 Replies View Related

Import Data From MS Access Databases To SQL Server 2000 Using The DTS Import/Export

Oct 16, 2006

I am attempting to import data from Microsoft Access databases to SQL Server 2000 using the DTS Import/Export Wizard. I have a few errors.

Error at Destination for Row number 1. Errors encountered so far in this task: 1.
Insert error column 152 ('ViewMentalTime', DBTYPE_DBTIMESTAMP), status 6: Data overflow.
Insert error column 150 ('VRptTime', DBTYPE_DBTIMESTAMP), status 6: Data overflow.
Insert error column 147 ('ViewAppTime', DBTYPE_DBTIMESTAMP), status 6: Data overflow.
Insert error column 144 ('VPreTime', DBTYPE_DBTIMESTAMP), status 6: Data overflow.
Insert error column 15 ('Time', DBTYPE_DBTIMESTAMP), status 6: Data overflow.
Invalid character value for cast specification.
Invalid character value for cast specification.
Invalid character value for cast specification.
Invalid character value for cast specification.
Invalid character value for cast specification.

Could you please look into this and guide me
Thanks in advance
venkatesh
imtesh@gmail.com

View 4 Replies View Related

IMPORT New Data Since Last IMPORT - DTS/Stored Procs?

Jan 7, 2004

Hello:

I am not sure how to implement the following, but I believe it entails using DTS, and hopefully it is fine that I post it here b/c ultimately I will need this backend data for my frontend .aspx pages:

On a weekly basis, I need to IMPORT some data located on a remote Oracle DB into SQL Server 2k. Since there is so much data to transfer, I would only like to transfer the data that is new to the table since the last IMPORT, i.e. a week ago and leave behin the OLD data.

Is DTS the correct way to go or do I have more control via DTS with STORED PROCEDURES? Does anyone have any good references for me?

On a similar note, once this Oracle data is IMPORTED into a certain table, I would like to EXPORT some of these NEWLY acquired rows matching certain criteria into another table for auditing purposes. For this scenario, should I implement a TRIGGER UPDATE event here on the first table?

Any advice will be greatly appreciated!

View 3 Replies View Related

Data Warehousing :: Copy Data From Staging Tables To Other Instance Master Tables?

Aug 14, 2015

I need to copy data from warehouse tables to master tables of different SQL instances. Refresh need to done once in an hour. What is the best way to do this? SQL agent jobs or SSIS packages?

View 3 Replies View Related

Import Tables

Nov 23, 2007



Hi,

Can I give a sequence to each table that I will try to import from one database to another by using import /export wizard

Regards

Vaibhav

View 1 Replies View Related

How To Import Tables From Other Database

Apr 13, 2007

Hi there,
I am having difficulties in importing table from one sql server database file to another sql server database file.
A few months ago, I converted access file to ms sql express file. I had made many changes on the ms sql express file, however, the data in this file isn't the latest as the old system is still being used. Now, I want to deploy my new system, I need to import in necessary tables from the old system database, as well as, I want to retain the tables and data I created on the ms sql express file that I have been using so far for development and testing.
May I know how to import tables from other database? Just as in ms access where we can import tables from other access file. I'm using sql express 2005 and sql server management tool. Any advice/help is very much appreciated.
Thanks....
 

View 2 Replies View Related

Import Access Tables Into SQL

Nov 6, 2007

Still really new at all this, but learning lots thanks to this forum.
I was wondering - is there a way to import Access tables into my SQL Server 2005 ?
(The Data and the Table Design?) 
 
 

View 3 Replies View Related

Import Tables To Excel

Apr 24, 2001

I would like to know:
How can I import tables from the Enterprise Manager to Excel (copy and paste)?
Is it possible?

thanks

View 1 Replies View Related

Import And Export Tables

Sep 7, 2006

I am really new to SQL Server so be patient i guess. I have installed sql server 2005 on my home computer but at first i wasnt able to connect to the server at school where i had started creating tables already. Instead of going up to the school i opted to do it from home and start over. Well I am wondering if there is a way to copy all the tables that i have created on my home computer and just import them into the database on the server at school. Hope this isnt confusing. Anyways, this forum always has helped me in the past, so i am confident someone will be able to point me in the right direction. Thanks in advance.

View 3 Replies View Related

Import Oracle Tables Using Dts Or Other...

Mar 29, 2006

i am using sql server express edition.
i need to import (or make copies) on a weekly/daily basis, of several oracle tables into a new adp database.

what is the fastest option? some of these tables hold over 1m records.
so ideally i would like to schedule a refresh or update job outside busy hours.

I have heard of "linked servers" and "dts", but would like some experts advice before starting looking into this.

many thanks
luzippu

View 3 Replies View Related

Import Access Tables To SQL

Nov 16, 2006

I have some Access tables that I want to import into SQL. I can do this using the AllTasks/ImportData. However if my Access table has a zero length string in a field this is imported into the SQL table as <NULL>. How can I make it import it as a zero length string ?

View 2 Replies View Related

Import XML Tables Into SQLExpress

Feb 21, 2008

I am an SQL newbie and despite 3 hours on the Internet this morning I am still confused!

I have some XML tables that I want to import into my SQLExpress database.

I have followed the example at http://support.microsoft.com/kb/316005 How to import XML into SQL Server with the XML Bulk Load component.

I understand the example but when I run the vb code:

Set objBL = CreateObject("SQLXMLBulkLoad.SQLXMLBulkLoad")
objBL.ConnectionString = "provider=SQLOLEDB.1;data source=MySQLServer;database=MyDatabase;uid=MyAccount;pwd=MyPassword"
objBL.ErrorLogFile = "c:error.log"
objBL.Execute "c:customermapping.xml", "c:customers.xml"
Set objBL = Nothing

I get an error message saying that ActiveX cannot create object 'SQLXMLBulkLoad.SQLXMLBulkLoad'.

I have SSMSE and the databse on my PC harddrive.

What am I missing here?

Thanks in antcipation.

Chris

View 5 Replies View Related

Import MSSQL Tables

Mar 19, 2006

Is there a way in SQL 2005 Express Edition to import/export data from another MSSQL Server? Something similar to the right click/ import table functionality of MSSQL2000.

I've read similar threads which all recommend using MS Access but there has to be a better way, right?

regards,
dj

View 9 Replies View Related

Import Tables From DB2 To Sql 2005

Jan 10, 2006

I have problems importing tables from db2 using the import wizard using IBM OLE DB Provider for DB2

The tables and data ('Preview...') can be viewed but when trying to map the columns ('Edit...' next to the tables) or import the data an error is recieved

[DB2/NT] SQL0443N  Routine "SYSIBM.SQLCOLUMNS" (specific name "COLUMNS") has returned an error SQLSTATE with diagnostic text "SYSIBM:CLI:-727".  SQLSTATE=38553

Schemas is used in both DB2 and Sql 2005

There is no problem importing to Sql 2000

 

View 1 Replies View Related

Import Tables From 2000

Mar 9, 2007

I'm trying to migrate some tables from 2000 to 2005. I used the wizard in SSIS to create a package bringing them in.

The first database I did this on it worked great, in no time.

However, I tried this on another database and I get a LOT of these:

Information: 0x4004800C at {0417E15E-7306-4DAD-BEDD-1FDB17390EB0}, DTS.Pipeline: The buffer manager detected that the system was low on virtual memory, but was unable to swap out any buffers. 2 buffers were considered and 2 were locked. Either not enough memory is available to the pipeline because not enough is installed, other processes are using it, or too many buffers are locked.

Now, some things to note:

1. I'm trying to do about 170 tables at once - although none of them are bigger than a MB

2. Copying files between these 2 servers is also taking a long time

Is it too many tables at once? Is it the actual pipeline between the servers? The message above seems to indicate that it is a problem local to the machine, and maybe our file-copying problem is just another issue entirely.

View 3 Replies View Related

Import Tables From MS Access

Dec 17, 2006

Hi all,
I've just installed the Sql Server 2005 Express Ed + Management Studio Express and I can't get how to import data from a MS Access 2003 file. From what I've read is not possible to do through the Management Studio Express so is there any other tool to do that?

Thanks in advance,

Marc Soleda

View 7 Replies View Related

What Is The Best Way Of Import From Xml File To A Sql Server Tables?

Mar 5, 2007

how do i import or what is the best way of import from xml file to a sql server tables?how do i export  or what is the best way of export from sql server tables to xml file?thanks

View 4 Replies View Related

Import All Tables From Sqlserver To Informix

May 19, 2008

hi
guys i need to  import all tables from sqlserver to informix ...............
 any idea really appreciated
 

View 5 Replies View Related

Import From Text File Into Two Tables

Jul 16, 2002

Quick Question!

If you have both invoice header lines and invoice detail lines in a comma delimited file, how can I get the data in the file to be imported into two different tables. I can produce a text file eg:

1,20,10/03/2002,39 High Street Any Town,,
2,20,Fluffy Slippers,2,Red,10.99
2,20,Pyjamas,3,Black,15.99
2,20,Trousers,1,Lilac,24.99
1,21,10/03/2002,11 Gibson Close,
2,21,Sandles,1,Black,12.99
2,21,Shoes,4,Blue,23.99
1,22,13/03/2002,45 Mill Street,
2,22,Womble Feet,4,White,16.99
2,22,Glass Slipper,1,Transparent,23.99

Lines with 1 in the first column should go in the InvoiceHeader table
Lines with 2 in the first column should go in the InvoiceDetails table.

I have tried with DTS but to no avial - ActiveX scrips in the Transform Data Task can only seem to access one data destination - it one table not two.

Any Ideas?

Julia

View 3 Replies View Related

Export/Import Tables W/ Primary Key

Nov 14, 2003

Can someone tell me if there's a way to export data from one database to another without losing the primary key information that has been set in the source database?

Please respond to URL. Thanks!

CC

View 1 Replies View Related

Import Excel Into 2 Related Tables

Jan 29, 2014

I have 1 Excel spreadsheet. It has about 50 fields. I need to import this into my Database.The problem is; there are 2 tables that I need to import this into. These 2 tables are related with [ID].So, I need to split the data from 1 spreadsheet between 2 SQL server table. and keep the records related.

View 4 Replies View Related

DTS Import CSV Record To Multiple Tables

Feb 24, 2004

Hi,

I am using DTS in SQL server2k

What is the best way to insert CSV records, where 1 record maps onto multiple tables with parent/child or PK/FK relationship.

eg.
CSV record
(ID, param1, param2, param3)

ParentTable(ID as PK)
Param1Table(ID as FK in ParentTable, param1)
Param2Table(ID as FK in ParentTable, param2)
Param3Table(ID as FK in ParentTable, param3)

Currently i am using multiple Transform Data tasks with ActiveX script. But it seems to work slow.

Thanks and regards,
Henry

View 1 Replies View Related

Trying To Create A DTS Package To Import Dbf Tables && Need Help

Mar 9, 2004

Hi There,
I am trying to create a DTS package that will import dbf tables. My problem is that the data was created back in the pre-dos 5 days, so to save room they took the dates and convert them to 2 characters.
Now I would like to import these tables and conver the date back. I do have a Function that I can run in FoxPro to "Unpack" these dates.


CODE
Function UnPackDate( cDate )

*!*PARAMETERS: f_datestr - Character (manditory). This should be a two
**!* byte string created with PACKDATE().
*!*
*!* RETURNS: A date from 1/1/1970 and 11/29/2126

If EMPTY(cDate)
Return {//}
Endif

Local nDate
nDate = (ASC( LEFT(cDate,1) ) * 256) + ASC( RIGHT(cDate,1))

Return ( CTOD("01/01/1970") + nDate - 8225 )

*================================================= ======================

Does anyone know how to take this function and make it work while doing an import?

Thanks
Sue

View 14 Replies View Related

Use C# To Import Access Tables Into SQL Server

Apr 30, 2007

Hi



I have to import some Access 2003 tables into a SQL Server 2005. Since I have to do this every 6 months (different Access db into same SQL-Server) and since I have to check every single row I can't do it with the import data wizzard. I need to import the access tables into "temporary" tables in sql server and from there I'll put the rows into the correct tables...



Does anyone know how to import Access tables into SQL-Server 2005 with C#?



Thank you for your help!



Michael

View 9 Replies View Related

Import Into Access Tables Using ODBC

Nov 28, 2006

Hi,

I want to import into an MDB table a csv file.

I'm trying to use the bulk copy table.

my function is:

SQL = "SELECT * INTO [my_table] FROM [ODBC;Driver=Micrsoft text driver (*.txt; *csv) ;Dbq=c:\;Extensions=asc,csv,tab,txt;].table.csv"

db.OpenEx( "Driver=Microsoft Access Driver .mdb);DBQ=c:\access.mdb;", CDatabase::noOdbcDialog );

db.ExecuteSQL( SQL );

when i run this function i get an error : "You cannot use ODBC to import from, export to, or link an external Microsoft Jet or ISAM database table to your database"

when i try to import in the same way a dbf file (insted the csv file) with VFP it's working well.

what seems to be the problem? how can i fix it? or if some one know how can i import a large csv file into access DB in an efficient diffrent way?

thanks ishay

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved