Showing posts with label xml. Show all posts
Showing posts with label xml. Show all posts

Wednesday, March 21, 2012

Dumping Data from a XML file to DB Tables

Hi All ,

I have an XML file saved in my machine at c:\MyXML.xml . I have two tables in my DB as Table1 ( [col1],[col2]) & Table2()[col1],[col2] . I have to dump the data from this xml file to these two tables in one shot .The format of the XML file MyXML.xml is something like this :

<?xml version = "1.0">

-<Report xmlns = " MyReport".......... >

- <table1>

- <Data>

<Record col1 = "A" col2 = "B" / >

<Record col1 = "C" col2 = "D" / >

<Record col1 = "E" col2 = "F" / >

</Data>

</table1>

- <table2>

- <Data>

<Record col1 = "A" col2 = "B" / >

<Record col1 = "C" col2 = "D" / >

<Record col1 = "E" col2 = "F" / >

</Data>

</table2>

</Report>

Plz suggest me some possible ways to get this done . I m using sql 2005.

Thanks in advance for the help.

Here is a complete example, you can use the OPENXML statement after the stored procedure sp_xml_preparedocument has parsed the XML:

Code Snippet

CREATE TABLE table1 (

col1 nvarchar(10),

col2 nvarchar(10)

);

CREATE TABLE table2 (

col1 nvarchar(10),

col2 nvarchar(10)

);

DECLARE @.xmlDocument xml;

SET @.xmlDocument = '<Report xmlns="MyReport">

<table1>

<Data>

<Record col1 = "A" col2 = "B" />

<Record col1 = "C" col2 = "D" />

<Record col1 = "E" col2 = "F" />

</Data>

</table1>

<table2>

<Data>

<Record col1 = "A" col2 = "B" />

<Record col1 = "C" col2 = "D" />

<Record col1 = "E" col2 = "F" />

</Data>

</table2>

</Report>';

DECLARE @.docHandle int;

EXEC sp_xml_preparedocument @.docHandle OUTPUT, @.xmlDocument, N'<Report xmlns:ns1="MyReport"/>';

INSERT INTO table1

SELECT *

FROM OPENXML (@.docHandle, N'/ns1:Report/ns1:table1/ns1:Data/ns1:Record', 0)

WITH table1;

INSERT INTO table2

SELECT *

FROM OPENXML (@.docHandle, N'/ns1:Report/ns1:table2/ns1:Data/ns1:Record', 0)

WITH table2;

EXEC sp_xml_removedocument @.docHandle;

SELECT col1, col2 FROM table1;

SELECT col1, col2 FROM table2

Wednesday, March 7, 2012

dtutil and xml configuration file

Hi,

Im loading the packages with a dutil-batch from the file-system into the sqlserver.

All the packages have xml-configuration-file.

for %%f in (*.dtsx) do dtutil /FILE %%f /COPY SQL;%%~nf /DestServer server /QUIET

When I try to run the packages in the sqlserver environment there is no configuration file found.

Is there a possibility to transfer also the link to the xml-configuration-file xml-configuration-file with dtutil?

Thanks Gerd

Moving to a better forum|||Try using the DTSDeployment utility to deploy packages that reference configuration files. The deployment utility will allow you to specify where to put the config files and will update the packages accordingly.|||

Hi

I am also in the same boat. I dont want to use deployment utility as I want to create a batch file. adminstrator will use this batch file to deploy on prod server.

I have configuration file that needs to be deployed on server along with package. please tell me if it possible or please give me work around for this.

|||You can specify the location of the configuration file when you run the package by using the /ConfigFile switch of DTEXEC.

dtutil and xml configuration file

Hi,

Im loading the packages with a dutil-batch from the file-system into the sqlserver.

All the packages have xml-configuration-file.

for %%f in (*.dtsx) do dtutil /FILE %%f /COPY SQL;%%~nf /DestServer server /QUIET

When I try to run the packages in the sqlserver environment there is no configuration file found.

Is there a possibility to transfer also the link to the xml-configuration-file xml-configuration-file with dtutil?

Thanks Gerd

Moving to a better forum|||Try using the DTSDeployment utility to deploy packages that reference configuration files. The deployment utility will allow you to specify where to put the config files and will update the packages accordingly.|||

Hi

I am also in the same boat. I dont want to use deployment utility as I want to create a batch file. adminstrator will use this batch file to deploy on prod server.

I have configuration file that needs to be deployed on server along with package. please tell me if it possible or please give me work around for this.

|||You can specify the location of the configuration file when you run the package by using the /ConfigFile switch of DTEXEC.

dtutil and xml configuration file

Hi,

Im loading the packages with a dutil-batch from the file-system into the sqlserver.

All the packages have xml-configuration-file.

for %%f in (*.dtsx) do dtutil /FILE %%f /COPY SQL;%%~nf /DestServer server /QUIET

When I try to run the packages in the sqlserver environment there is no configuration file found.

Is there a possibility to transfer also the link to the xml-configuration-file xml-configuration-file with dtutil?

Thanks Gerd

Moving to a better forum|||Try using the DTSDeployment utility to deploy packages that reference configuration files. The deployment utility will allow you to specify where to put the config files and will update the packages accordingly.|||

Hi

I am also in the same boat. I dont want to use deployment utility as I want to create a batch file. adminstrator will use this batch file to deploy on prod server.

I have configuration file that needs to be deployed on server along with package. please tell me if it possible or please give me work around for this.

|||You can specify the location of the configuration file when you run the package by using the /ConfigFile switch of DTEXEC.

Sunday, February 26, 2012

DTS-example

I found this useful:
http://www.perfectxml.com/articles/xml/importxmlsql.asp#4
But I didn't get the example (DTS ActiveX Script & MSXML 4.0 DOM) to
work.Got the error message:
'Can't create object: MSXML2.DOMDocument.4.0'
/Kent J,"Kent Johnson" <08.6044303@.telia.com> wrote in message
news:e7zgd.7447$d5.63210@.newsb.telia.net...
> I found this useful:
> http://www.perfectxml.com/articles/xml/importxmlsql.asp#4
> But I didn't get the example (DTS ActiveX Script & MSXML 4.0 DOM) to
> work.Got the error message:
> 'Can't create object: MSXML2.DOMDocument.4.0'
> /Kent J,
You need to install XML 4.0. Goto http://msdn.microsoft.com. In the "Search
MSDN for" box type in XML 4.0. Click Code and Downloads then the "Go"
button.|||Ron,
Great! Now it works!
/Kent J.
"Ron Hinds" <__NoSpam__ron@.__ramac__.com> wrote in message
news:#pfegggvEHA.1308@.TK2MSFTNGP09.phx.gbl...
> "Kent Johnson" <08.6044303@.telia.com> wrote in message
> news:e7zgd.7447$d5.63210@.newsb.telia.net...
> > I found this useful:
> > http://www.perfectxml.com/articles/xml/importxmlsql.asp#4
> >
> > But I didn't get the example (DTS ActiveX Script & MSXML 4.0 DOM) to
> > work.Got the error message:
> > 'Can't create object: MSXML2.DOMDocument.4.0'
> >
> > /Kent J,
> You need to install XML 4.0. Goto http://msdn.microsoft.com. In the
"Search
> MSDN for" box type in XML 4.0. Click Code and Downloads then the "Go"
> button.
>

Friday, February 24, 2012

DTS/XML conversion utility avaialable?

I recently viewed a webcast called "Microsoft Business Intelligence Product
Architecture for ISVs" where they demostrated the DSO/XML conversion utility
and a DTS/XML conversion utility. I have used the DSO tool but could realy
use the samething for DTS packages. I seached and can seem to find a downloa
d
for it.
Anyone know anything about it or where I can get it?http://www.microsoft.com/downloads/...&DisplayLang=en
Ohjoo Kwon
"bmacatpsi" <bmacatpsi@.discussions.microsoft.com> wrote in message
news:FCABD584-B6D1-4D42-9554-6B8D0054FFD4@.microsoft.com...
> I recently viewed a webcast called "Microsoft Business Intelligence
Product
> Architecture for ISVs" where they demostrated the DSO/XML conversion
utility
> and a DTS/XML conversion utility. I have used the DSO tool but could realy
> use the samething for DTS packages. I seached and can seem to find a
download
> for it.
> Anyone know anything about it or where I can get it?|||Thanks for your prompts response,
However thats for the DSO utility and I am looking for the DTS/XML
Conversion utility.
Anyone?
"Ohjoo Kwon" wrote:

> http://www.microsoft.com/downloads/...&DisplayLang=en
> Ohjoo Kwon
>
> "bmacatpsi" <bmacatpsi@.discussions.microsoft.com> wrote in message
> news:FCABD584-B6D1-4D42-9554-6B8D0054FFD4@.microsoft.com...
> Product
> utility
> download
>
>|||You need to contact the presenter of the webcast. It is his personal
utility.
Drop me an email and I will forward accordingly.
--
Dave Wickert [MSFT]
dwickert@.online.microsoft.com
Program Manager
BI SystemsTeam
SQL BI Product Unit (Analysis Services)
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"bmacatpsi" <bmacatpsi@.discussions.microsoft.com> wrote in message
news:C13EF544-E01F-4969-AEF7-9DFD9C2CEEB0@.microsoft.com...[vbcol=seagreen]
> Thanks for your prompts response,
> However thats for the DSO utility and I am looking for the DTS/XML
> Conversion utility.
> Anyone?
> "Ohjoo Kwon" wrote:
>
http://www.microsoft.com/downloads/... />
layLang=en[vbcol=seagreen]
realy[vbcol=seagreen]

Dts.log in script task

Hi

Can someone tell me where I can find the log file created by the Dts.log method in script task.

I have created a log provider file as Mylog.xml, but the messages recorded are from the Dts.Event.FireInformation method and not the Dts.log method.

I don't know where the messages are filed.

Regards

Baldev

To log the output of Dts.Log() to a Log Provider, go to the "Configure SSIS Logs" dialog (e.g. SSIS/Logging...). Change the Logging Mode on the Script Task from the default of "UseParentSetting" to "Enabled". That is , click on the check box next to the Script task until it is checked ( LoggingMode = "Enabled") and not checked and greyed out (LoggingMode = "UseParentSetting") or unchecked (LoggingMode = "Disabled").

With the Script Task node selected, navigate to the Details tab, and select the "ScriptTaskLogEntry" event. Dts.Log() calls will now be sent to whatever log providers are enabled for the Script Task itself. Also, make sure to select the log provider for the script task "again", since this is effectively overriding the parent containers logging settings.

|||

Great, that's exactly what I wanted.

Thanks a lot

Baldev