Showing posts with label structure. Show all posts
Showing posts with label structure. Show all posts

Monday, March 26, 2012

Forcing Function recompilation in SQL 2000

A stored procedure in the cache is automatically recompiled when a table it refers to has a table structure change. User defined functions are not. Here's a simplified code sample:

set nocount on
go

create table tmpTest (a int, b int, c int)

insert into tmpTest (a, b, c) values (1, 2, 3)
insert into tmpTest (a, b, c) values (2, 3, 4)
go

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[fTest]') and xtype in (N'FN', N'IF', N'TF'))
drop function [dbo].[fTest]
GO

CREATE FUNCTION dbo.fTest (@.a int)
RETURNS TABLE
AS
RETURN (SELECT * from tmpTest where a = @.a)
GO

select * from fTest(1)

CREATE TABLE dbo.Tmp_tmpTest
(
a int NULL,
b int NULL,
d int NULL,
c int NULL
) ON [PRIMARY]
IF EXISTS(SELECT * FROM dbo.tmpTest)
EXEC('INSERT INTO dbo.Tmp_tmpTest (a, b, c)
SELECT a, b, c FROM dbo.tmpTest TABLOCKX')
DROP TABLE dbo.tmpTest
EXECUTE sp_rename N'dbo.Tmp_tmpTest', N'tmpTest', 'OBJECT'

select * from fTest(1)

drop table tmpTest

Running it, the output is:

a b c
-- -- --
1 2 3

Caution: Changing any part of an object name could break scripts and stored procedures.
The OBJECT was renamed to 'tmpTest'.
a b c
-- -- --
1 2 NULL

(I know that "select *" is bad, but it's a lot of legacy code that I'm working with here, and that's how it's written.)

The function doesn't detect that the table has changed in structure, or even that there is no longer a dependency on tmpTest. (Appending a column rather than inserting has the same effect, in that only the first 3 columns are returned.)

DBCC FREEPROCCACHE has no effect, not that I really expected it to, but you never know...

Is there any way, other than dropping and recreating, to force a recompilation of a particular function in memory, or perhaps all functions?

Thanks in anticipation.

Tom

try this example from the Books Online...

USE pubs IF EXISTS (SELECT name FROM sysobjects WHERE name = 'titles_by_author' AND type = 'P') DROP PROCEDURE titles_by_author GO CREATE PROCEDURE titles_by_author @.@.LNAME_PATTERN varchar(30) = '%' WITH RECOMPILE AS SELECT RTRIM(au_fname) + ' ' + RTRIM(au_lname) AS 'Authors full name', title AS Title FROM authors a INNER JOIN titleauthor ta ON a.au_id = ta.au_id INNER JOIN titles t ON ta.title_id = t.title_id WHERE au_lname LIKE @.@.LNAME_PATTERN GO |||

Thanks for the suggestion. Just one small point:

It's a function, not a procedure. And WITH RECOMPILE isn't a valid option for a function.

Tom

|||It is because of the SELECT *. Inline table-valued function is similar to view in that the metadata for the columns are persisted at the time of creation of the function. So in your example, the * in the select list will get resolved to table/columns at creation time. You will have to run ALTER FUNCTION or drop/recreate the function to recreate the correct metadata in current versions of SQL Server. SQL Server 2005 SP2 will have a new system stored procedure that can be used to refresh such metadata for SPs, UDFs. This will be similar to sp_refreshview SP. Of course, you wouldn't get into these problems if you specified column names explicitly.

Monday, March 12, 2012

FOR/NEXT/LOOP structure?

I'm just getting up on SQL and I have a very basic issue. How would you
implement a "loop" or FOR/NEXT directive in SQL. I have looked around and do
not see anything that seems like a likely command. Thanks in advance for you
r
input.> How would you implement a "loop" or FOR/NEXT directive in SQL.
There is WHILE/BEGIN/END. However, usually, you would do what you need to
do WITHOUT resorting to loops. SQL is based fundamentally on treating data
as sets rather than iterations. If you give us more details about what you
are trying to accomplish, instead of deciding that you need to use loops,
you will probably get better help and will be on your way to thinking in
sets instead of singletons.
Please post DDL, sample data and desired results.
See http://www.aspfaq.com/5006 for info.|||TSQL has WHILE loops.
Hopefully I don't need to tell you that Iterating through a table or
result set in SQL isn't a good idea. Best practice is to write your
data manipulation as set-based code without loops. If you need help to
do that, then please come back with some more information of what you
are trying to do.
David Portas
SQL Server MVP
--|||We are making a big jump fromthe xBase world... my brain is still adjusting.
In my database I have tmpTable1...tmpTable99 and mastertable
I want to do an INSERT INTO mastertable for each tmpTable
Although syntactically incorrect, Something like...
FOR tblCount = 1 TO 99
INSERT INTO mastertable SELECT (fields) FROM tmpTable##
DROP table##
NEXT tblCount
"Aaron [SQL Server MVP]" wrote:

> There is WHILE/BEGIN/END. However, usually, you would do what you need to
> do WITHOUT resorting to loops. SQL is based fundamentally on treating dat
a
> as sets rather than iterations. If you give us more details about what yo
u
> are trying to accomplish, instead of deciding that you need to use loops,
> you will probably get better help and will be on your way to thinking in
> sets instead of singletons.
> --
> Please post DDL, sample data and desired results.
> See http://www.aspfaq.com/5006 for info.
>
>|||In that case the real question is why do you have 99 separate tables to
start with? Apparently they are all the same structure so in the SQL
world it makes much more sense to have ONE table, if necessary with an
extra column for whatever attribute is represented by the number 1 -
99.
If this is just a one-off exercise then you can just cut and paste a
script of 99 INSERT statements. If this is something you feel the need
to do regularly then you should definitely reconsider your design - fix
whatever process creates these tables so that it just creates one table
instead.
If you are stuck with 99 separate tables and don't want to hard-code
the names then you will be forced to use a messy kludge with dynamic
SQL. Unlike xBase you can't easily parameterize table names in SQL
Server. Instead you have to build a command string and execute it like
a macro using the EXEC statement. That's one reason why good logical
database design is so important.
Dynamic SQL introduces a number of problems to do with performance,
scalability, maintenance and security. Don't go there if you can
possibly avoid it, and read the following article first:
http://www.sommarskog.se/dynamic_sql.html
David Portas
SQL Server MVP
--|||> In that case the real question is why do you have 99 separate tables to
> start with?
Hey, at least it seems he's trying to fix it. :-) And he can generate his
list of INSERT statements pretty easily, e.g. using Query Analyzer:
DECLARE @.i TINYINT
SET @.i = 1
WHILE @.i <= 99
BEGIN
PRINT 'INSERT mastertable(column_list) SELECT column_list FROM
tmpTable'+RTRIM(@.i)
SET @.i = @.i + 1
END
But I agree with everything else you said... hopefully this is a one-time
thing and not something that is going to become a part of the app.
Please post DDL, sample data and desired results.
See http://www.aspfaq.com/5006 for info.|||>> We are making a big jump fromthe xBase world... my brain is still
adjusting. <<
It will take at least a year to un-learn the old mental models.
That would be a UNION of all the tables. But this sounds like your
schema and appraoch are wrong. Instead of 99 identical tables, why not
one table with an integer column that holds whatever information is
need to show the source of the data?|||The WHILE loop worked nicely. Thanks for the input!
"The VanDerbeck Group" wrote:

> I'm just getting up on SQL and I have a very basic issue. How would you
> implement a "loop" or FOR/NEXT directive in SQL. I have looked around and
do
> not see anything that seems like a likely command. Thanks in advance for y
our
> input.

Friday, March 9, 2012

FOR XML PATH + file structure

Hey there,
I used the FOR XML PATH feature but the XML result is in only one line,
it does not conserve the XML structure (treeview). When I open the XML
file with IE, it s working very (I have the XML hierarchy) but when I
use Visual Studio or other tool to edit it, I ve just one line!
For example:
<children group=""><child firstname="" lastname=""></child>=""><child
firstname=""
lastname=""></child>.......................</children>.........
And I d like to have
<children group="">
<child firstname="" lastname=""></child>="">
<child firstname="" lastname=""></child>
......................
</children>
..........
To give you an example of the query:
SELECT Child.group AS '@.group',
(SELECT firstname AS '@.firstname',
lastname AS '@.lastname'
FROM Collecte_Data_Extract cde
FOR XML PATH('child'), TYPE)
FROM Feed AS Child
FOR XML PATH('children'), TYPE
Any idea?
Many thanks in advanceThe structure is "conserved"; the whitespace is not. Actually what's
happening is IE is adding whitespace (linefeeds and tabs) to display your
XML. If you want to format your XML in Visual Studio, create a new XML
file, copy and paste your XML into it, and select Edit > Advanced > Format
from the main menu. The extra linefeeds and tabs are irrelevant to your XML
parser (or at least should be).
"Vins" <vbellet@.gmail.com> wrote in message
news:1165406662.637039.25890@.f1g2000cwa.googlegroups.com...
> Hey there,
> I used the FOR XML PATH feature but the XML result is in only one line,
> it does not conserve the XML structure (treeview). When I open the XML
> file with IE, it s working very (I have the XML hierarchy) but when I
> use Visual Studio or other tool to edit it, I ve just one line!
>
> For example:
> <children group=""><child firstname="" lastname=""></child>=""><child
> firstname=""
> lastname=""></child>.......................</children>.........
>
> And I d like to have
> <children group="">
> <child firstname="" lastname=""></child>="">
> <child firstname="" lastname=""></child>
> .......................
> </children>
> ..........
>
> To give you an example of the query:
>
> SELECT Child.group AS '@.group',
>
> (SELECT firstname AS '@.firstname',
> lastname AS '@.lastname'
>
> FROM Collecte_Data_Extract cde
>
> FOR XML PATH('child'), TYPE)
>
> FROM Feed AS Child
> FOR XML PATH('children'), TYPE
>
> Any idea?
> Many thanks in advance
>|||In fact the idea is to have the result dynamically.
For example if I choose to open this XML file in NotePad it does work|||"Vins" <vbellet@.gmail.com> wrote in message
news:1165833640.839620.293150@.16g2000cwy.googlegroups.com...
> In fact the idea is to have the result dynamically.
> For example if I choose to open this XML file in NotePad it does work
Huh?

FOR XML PATH + file structure

Hey there,
I used the FOR XML PATH feature but the XML result is in only one line,
it does not conserve the XML structure (treeview). When I open the XML
file with IE, it s working very (I have the XML hierarchy) but when I
use Visual Studio or other tool to edit it, I ve just one line!
For example:
<children group=""><child firstname="" lastname=""></child>=""><child
firstname=""
lastname=""></child>.......................</children>.........
And I d like to have
<children group="">
<child firstname="" lastname=""></child>="">
<child firstname="" lastname=""></child>
.......................
</children>
...........
To give you an example of the query:
SELECT Child.group AS '@.group',
(SELECT firstname AS '@.firstname',
lastname AS '@.lastname'
FROM Collecte_Data_Extract cde
FOR XML PATH('child'), TYPE)
FROM Feed AS Child
FOR XML PATH('children'), TYPE
Any idea?
Many thanks in advance
The structure is "conserved"; the whitespace is not. Actually what's
happening is IE is adding whitespace (linefeeds and tabs) to display your
XML. If you want to format your XML in Visual Studio, create a new XML
file, copy and paste your XML into it, and select Edit > Advanced > Format
from the main menu. The extra linefeeds and tabs are irrelevant to your XML
parser (or at least should be).
"Vins" <vbellet@.gmail.com> wrote in message
news:1165406662.637039.25890@.f1g2000cwa.googlegrou ps.com...
> Hey there,
> I used the FOR XML PATH feature but the XML result is in only one line,
> it does not conserve the XML structure (treeview). When I open the XML
> file with IE, it s working very (I have the XML hierarchy) but when I
> use Visual Studio or other tool to edit it, I ve just one line!
>
> For example:
> <children group=""><child firstname="" lastname=""></child>=""><child
> firstname=""
> lastname=""></child>.......................</children>.........
>
> And I d like to have
> <children group="">
> <child firstname="" lastname=""></child>="">
> <child firstname="" lastname=""></child>
> .......................
> </children>
> ..........
>
> To give you an example of the query:
>
> SELECT Child.group AS '@.group',
>
> (SELECT firstname AS '@.firstname',
> lastname AS '@.lastname'
>
> FROM Collecte_Data_Extract cde
>
> FOR XML PATH('child'), TYPE)
>
> FROM Feed AS Child
> FOR XML PATH('children'), TYPE
>
> Any idea?
> Many thanks in advance
>
|||In fact the idea is to have the result dynamically.
For example if I choose to open this XML file in NotePad it does work
|||"Vins" <vbellet@.gmail.com> wrote in message
news:1165833640.839620.293150@.16g2000cwy.googlegro ups.com...
> In fact the idea is to have the result dynamically.
> For example if I choose to open this XML file in NotePad it does work
Huh?

FOR XML PATH + file structure

Hey there,

I used the FOR XML PATH feature but the XML result is in only one line,
it does not conserve the XML structure (treeview). When I open the XML
file with IE, it s working very (I have the XML hierarchy) but when I
use Visual Studio or other tool to edit it, I ve just one line!

For example:
<children group=""><child firstname="" lastname=""></child>=""><child
firstname=""
lastname=""></child>.......................</children>.........

And I d like to have
<children group="">
<child firstname="" lastname=""></child>="">
<child firstname="" lastname=""></child>
.......................
</children>
...........

To give you an example of the query:

SELECTChild.group AS '@.group',

(SELECT firstnameAS '@.firstname',
lastnameAS '@.lastname'

FROM Collecte_Data_Extract cde

FOR XML PATH('child'), TYPE)

FROM Feed AS Child
FOR XML PATH('children'), TYPE

Any idea?
Many thanks in advanceVins (vbellet@.gmail.com) writes:

Quote:

Originally Posted by

I used the FOR XML PATH feature but the XML result is in only one line,
it does not conserve the XML structure (treeview). When I open the XML
file with IE, it s working very (I have the XML hierarchy) but when I
use Visual Studio or other tool to edit it, I ve just one line!


Trying running the query in Mgmt Studio, and then double-click on the
XML document to open it the XML viewer. If you save from the viewer
you get the format you are looking for.

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx|||Thanks Erland but I want to do this dynamically, it s boring to do this
for each file (it s a daily report)

Other idea?|||Vins (vbellet@.gmail.com) writes:

Quote:

Originally Posted by

Thanks Erland but I want to do this dynamically, it s boring to do this
for each file (it s a daily report)


If it's a daily report, I assume that you run the program from a client.
Then I guess there is a suitable API that you can use to format your XML.

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx

For XML Explicit Structure

Hello everyone,
I'm trying to create an XML file using FOR XML EXPLICIT. However, I
need part of my result to look like this:
<Serial>
<SerialNuber>123456</SerialNumber>
<SerialNuber>123457</SerialNumber>
<SerialNuber>123458</SerialNumber>
</Serial>
What is happening is that I am only able to get repeating attributes
to appear as follows:
<Serial>
<SerialNumber>123456</SerialNumber>
</Serial>
<Serial>
<SerialNumber>123457</SerialNumber>
</Serial>
<Serial>
<SerialNumber>123458</SerialNumber>
</Serial>
Does anyone know what I may be doing wrong?
Thanks!!
Rey
Bear in mind that FOR XML EXPLICIT only returns an XML fragment - not a
well-formed document. So your query could return the <SerialNumber>
elements, but your client application would have to add the <Serial> root
tag.
The query should look something like
SELECT 1 AS Tag,
NULL As Parent,
Serialno As [SerialNumber!1]
FROM myTable
FOR XML EXPLICIT
Adding the root tag depends on the client-side application used to execute
the query. The SQLXML OLEDB provider and the SQLXML Managed classes have a
property on the Command object to do that.
NB: FOR XML in SQL Server 2005 includes a ROOT directive to add a root tag
but I'm afraid in SQL Server 2000 you can only get a fragment.
Cheers,
Graeme
--
Graeme Malcolm
Principal Technologist
Content Master Ltd.
www.contentmaster.com
"Rey" <rdiaz@.hotmail.com> wrote in message
news:a696a6c7.0408240723.1ae34deb@.posting.google.c om...
Hello everyone,
I'm trying to create an XML file using FOR XML EXPLICIT. However, I
need part of my result to look like this:
<Serial>
<SerialNuber>123456</SerialNumber>
<SerialNuber>123457</SerialNumber>
<SerialNuber>123458</SerialNumber>
</Serial>
What is happening is that I am only able to get repeating attributes
to appear as follows:
<Serial>
<SerialNumber>123456</SerialNumber>
</Serial>
<Serial>
<SerialNumber>123457</SerialNumber>
</Serial>
<Serial>
<SerialNumber>123458</SerialNumber>
</Serial>
Does anyone know what I may be doing wrong?
Thanks!!
Rey
|||You could add a second select clause in the explicit mode to add a root
clause (although that is not as performant as using the provider property).
See the FOR XML in SQL Server 2005 whitepaper on MSDN for an example of such
an explicit mode query
(http://msdn.microsoft.com/XML/Buildi.../forxml2k5.asp).
HTH
Michael
"Graeme Malcolm" <graemem_cm@.hotmail.com> wrote in message
news:%23iJQXKgiEHA.4056@.TK2MSFTNGP09.phx.gbl...
> Bear in mind that FOR XML EXPLICIT only returns an XML fragment - not a
> well-formed document. So your query could return the <SerialNumber>
> elements, but your client application would have to add the <Serial> root
> tag.
> The query should look something like
> SELECT 1 AS Tag,
> NULL As Parent,
> Serialno As [SerialNumber!1]
> FROM myTable
> FOR XML EXPLICIT
> Adding the root tag depends on the client-side application used to execute
> the query. The SQLXML OLEDB provider and the SQLXML Managed classes have a
> property on the Command object to do that.
> NB: FOR XML in SQL Server 2005 includes a ROOT directive to add a root tag
> but I'm afraid in SQL Server 2000 you can only get a fragment.
> Cheers,
> Graeme
> --
> --
> Graeme Malcolm
> Principal Technologist
> Content Master Ltd.
> www.contentmaster.com
>
> "Rey" <rdiaz@.hotmail.com> wrote in message
> news:a696a6c7.0408240723.1ae34deb@.posting.google.c om...
> Hello everyone,
> I'm trying to create an XML file using FOR XML EXPLICIT. However, I
> need part of my result to look like this:
> <Serial>
> <SerialNuber>123456</SerialNumber>
> <SerialNuber>123457</SerialNumber>
> <SerialNuber>123458</SerialNumber>
> </Serial>
> What is happening is that I am only able to get repeating attributes
> to appear as follows:
> <Serial>
> <SerialNumber>123456</SerialNumber>
> </Serial>
> <Serial>
> <SerialNumber>123457</SerialNumber>
> </Serial>
> <Serial>
> <SerialNumber>123458</SerialNumber>
> </Serial>
> Does anyone know what I may be doing wrong?
> Thanks!!
> Rey
>
|||Michael is (as always) right on the money! You could write the query like
this:
SELECT 1 AS Tag,
NULL As Parent,
NULL As [Serial!1!dummyattribute],
NULL AS [SerialNumber!2]
UNION ALL
SELECT 2,
1,
NULL,
SerialNo
FROM myTable
ORDER BY Tag
FOR XML EXPLICIT
This would generate the root tag for you.
Hope that helps,
Graeme
--
Graeme Malcolm
Principal Technologist
Content Master Ltd.
www.contentmaster.com
"Michael Rys [MSFT]" <mrys@.online.microsoft.com> wrote in message
news:euFZISgiEHA.2704@.TK2MSFTNGP10.phx.gbl...
You could add a second select clause in the explicit mode to add a root
clause (although that is not as performant as using the provider property).
See the FOR XML in SQL Server 2005 whitepaper on MSDN for an example of such
an explicit mode query
(http://msdn.microsoft.com/XML/Buildi.../forxml2k5.asp).
HTH
Michael
"Graeme Malcolm" <graemem_cm@.hotmail.com> wrote in message
news:%23iJQXKgiEHA.4056@.TK2MSFTNGP09.phx.gbl...
> Bear in mind that FOR XML EXPLICIT only returns an XML fragment - not a
> well-formed document. So your query could return the <SerialNumber>
> elements, but your client application would have to add the <Serial> root
> tag.
> The query should look something like
> SELECT 1 AS Tag,
> NULL As Parent,
> Serialno As [SerialNumber!1]
> FROM myTable
> FOR XML EXPLICIT
> Adding the root tag depends on the client-side application used to execute
> the query. The SQLXML OLEDB provider and the SQLXML Managed classes have a
> property on the Command object to do that.
> NB: FOR XML in SQL Server 2005 includes a ROOT directive to add a root tag
> but I'm afraid in SQL Server 2000 you can only get a fragment.
> Cheers,
> Graeme
> --
> --
> Graeme Malcolm
> Principal Technologist
> Content Master Ltd.
> www.contentmaster.com
>
> "Rey" <rdiaz@.hotmail.com> wrote in message
> news:a696a6c7.0408240723.1ae34deb@.posting.google.c om...
> Hello everyone,
> I'm trying to create an XML file using FOR XML EXPLICIT. However, I
> need part of my result to look like this:
> <Serial>
> <SerialNuber>123456</SerialNumber>
> <SerialNuber>123457</SerialNumber>
> <SerialNuber>123458</SerialNumber>
> </Serial>
> What is happening is that I am only able to get repeating attributes
> to appear as follows:
> <Serial>
> <SerialNumber>123456</SerialNumber>
> </Serial>
> <Serial>
> <SerialNumber>123457</SerialNumber>
> </Serial>
> <Serial>
> <SerialNumber>123458</SerialNumber>
> </Serial>
> Does anyone know what I may be doing wrong?
> Thanks!!
> Rey
>

Wednesday, March 7, 2012

FOR XML EXPLICIT and namespaces

I'm trying to get a fairly complex structure from SQL Server 2000 to a client via classes generated with an xsd file and transferred through Web Services.
I can get the SQL stuff to work nicely if I have no tragetNamespace in the xsd.
However, then I cannot create a client proxy for my web service.
If I specify a (matching) targetNamespace in the web service description and the xsd file then I can create a proxy. However, at this point the XML produced by the SQL FOR XML EXPLICIT no longer validates.
I imagine this will be fixed if I specifiy a target namespace for my FOR XML EXPLICIT query (that is the root element should have a targetNamespace attribute).
I cannot see how to do this. There is sem reference to templates, but I believe these are use from http and I can't see any logical way to embed these in my SPROCS or ExecuteXmlReader calls.
Iain
"Iain" wrote:

> I'm trying to get a fairly complex structure from SQL Server 2000 to a client via classes generated with an xsd file and transferred through Web Services.
> I can get the SQL stuff to work nicely if I have no tragetNamespace in the xsd.
...
Well, I found somewhere someone putting the xmlns in as a separate column in the select query. So ...
'http://idcl.co.uk/PBWebAdmin' as [OrderBatch!1!xmlns],
and equivalent nulls in all the union locations.
This resulted in a query that worked sort of. Now for some reason it was rejecting the name and address elements (<FullName ..>, <Add1 ..>) in a <DeliveryAddress> element a couple of nests down.
I fixed this by changing the elements in the element to attributes.
I don't know why this worked.
Iain
|||Adding xmlns or xmlns:foo (and then using !foo:bar) columns as you do are
the way to add namespaces in FOR XML currently (note that the PATH mode in
Beta2 will not support this and I am working on getting a better solution
for at least the PATH mode made available in Beta3).
If you use xmlns without specifying a prefix, all descending elements will
be in that namespace (unless another xmlns overwrites it). If your schema
does not allow those elements to be in that namespace, you may have a
problem.
Attributes on the other hand are never part of the default namespace. They
belong to the element unless an explicit namespace prefix has been
associated.
So this difference may account for what you see.
HTH
Michael
"Iain" <Iain@.discussions.microsoft.com> wrote in message
news:4B201E22-E0AF-4B12-9D98-E8B2DE3BD143@.microsoft.com...
> "Iain" wrote:
> ...
> Well, I found somewhere someone putting the xmlns in as a separate column
> in the select query. So ...
> 'http://idcl.co.uk/PBWebAdmin' as [OrderBatch!1!xmlns],
> and equivalent nulls in all the union locations.
> This resulted in a query that worked sort of. Now for some reason it was
> rejecting the name and address elements (<FullName ..>, <Add1 ..>) in a
> <DeliveryAddress> element a couple of nests down.
> I fixed this by changing the elements in the element to attributes.
> I don't know why this worked.
> Iain
>