Sunday, February 26, 2012
FOR XML
I'm performing a query against a db with "for xml auto, elements" clause
Something like
Table
Field 0 Setas Primary Key
Field 1
Field 2
SELECT field1, field2 FROM table FOR XML AUTO,ELEMENTS
If I run the query into Query Analyzer I get the result I aspect
<table>
<field1>value</field1>
<field2>value</field2>
<table>
<table>
<field1>value</field1>
<field2>value</field2>
<table>
but if I run the same query from a .vbs script (using wscript to launch it)
I get the following
<table>
<field0>value</field0>
<field1>value</field1>
<field2>value</field2>
<table>
<table>
<field0>value</field0>
<field1>value</field1>
<field2>value</field2>
<table>
The primary key is automatically inserted in the xml
Does somebody know the reason? how to workaround it? or to control it?
ThanksPerhaps your process needs to more specifically map the elements:
http://www.eggheadcafe.com/articles/20030804.asp
2005 Microsoft MVP C#
Robbe Morris
http://www.robbemorris.com
http://www.masterado.net/home/listings.aspx
"Denis" <dzoddi@.mvmnet.com> wrote in message
news:%23%23A2vhuKFHA.4092@.tk2msftngp13.phx.gbl...
> Hello
> I'm performing a query against a db with "for xml auto, elements" clause
> Something like
> Table
> Field 0 Setas Primary Key
> Field 1
> Field 2
> SELECT field1, field2 FROM table FOR XML AUTO,ELEMENTS
> If I run the query into Query Analyzer I get the result I aspect
> <table>
> <field1>value</field1>
> <field2>value</field2>
> <table>
> <table>
> <field1>value</field1>
> <field2>value</field2>
> <table>
> but if I run the same query from a .vbs script (using wscript to launch
> it) I get the following
> <table>
> <field0>value</field0>
> <field1>value</field1>
> <field2>value</field2>
> <table>
> <table>
> <field0>value</field0>
> <field1>value</field1>
> <field2>value</field2>
> <table>
> The primary key is automatically inserted in the xml
> Does somebody know the reason? how to workaround it? or to control it?
> Thanks
>
>
Sunday, February 19, 2012
For Each Loop Failure when some values in recordset are NULL
I have a for each loop container that is performing various tasks as it loops through a record set. Some of the values from the recordset are NULL at times and this causes the FELC to fail because it is unable to map the variables that have NULL values.
Is there something I can set to have it accept the NULLS or something I can change about the variables themselves. This is valid data that still needs to be processed. There are other attributes that have data in the record.
Here are samples of my error messages:
Error: ForEach Variable Mapping number 19 to variable "User::varTransactionReference" cannot be applied.
Error: ForEach Variable Mapping number 20 to variable "User::varFlowStartDate" cannot be applied.
Error: ForEach Variable Mapping number 26 to variable "User::varCancelFee" cannot be applied.
Thanks in advance.
SK
SK1000,
The For Each control is weak. There are much better controls
that you can use to process records. Here is 2
web pages that discuss different techniques using different
controls.
This is my web site
http://www.mathgv.com/sql2005docs/SSISTransformScriptETL.htm
This Jamie
Thompson's cool blog.
http://blogs.conchango.com/jamiethomson/archive/2006/09/12/SSIS_3A00_-Checking-if-a-row-exists-and-if-it-does_2C00_-has-it-changed.aspx
Thanks,
Greg Van
Mullem
|||Thanks, Greg. I will look at both options.
SK