Re: XSD and BulkInsert



Hi Rùben,
I have already tried the WhiteSpace command: it seems it is not recognized
by BulkInsert. I'm currently using the XSD, and not the XDR.



"Rubén Garrigós" wrote:

Try to change the definition of plate2 to:

<xs:element name="PLATE2" minOccurs="0" sql:field="StrTrailerPlate">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:whiteSpace value=“preserve”/>
<xs:maxLength value="20"/>
</xs:restriction>
</xs:simpleType>
</xs:element>

You are using XDR reprecated attributes (sql:field). If you want to upgrade
ugrade to a XSD schema
(http://msdn2.microsoft.com/en-us/library/ms171874.aspx) can help you.

You can try not allowing nulls into the table and see if it makes any
difference. Try adding a default value of ' ' to the column too.

--

Rubén Garrigós
Solid Quality Mentors

"Tatopitta" <Tatopitta@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:F3182466-DECE-4040-832B-23E951E5F336@xxxxxxxxxxxxxxxx
This is an example of the message:
<Message>
<Vehicle>
<PLATE1>33EDJ78</PLATE1>
<PLATE2> </PLATE2>
...


Example of XSD:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";
xmlns:sql="urn:schemas-microsoft-com:mapping-schema">
<xs:element name="Vehicle" sql:relation="TmpVehicle">
<xs:complexType>
<xs:sequence>
<xs:element name="PLATE1" sql:field="StrEnginePlate">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="20"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="PLATE2" minOccurs="0" sql:field="StrTrailerPlate">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="20"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
...


Thanks a lot!!!

"Rubén Garrigós" wrote:

Hmm maybe the problem is related with the xsi:nil property or the schema
used. Can you send an example of the XML file?

"Tatopitta" <Tatopitta@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:D940BCC0-D262-4CFD-BF20-4E170F015F06@xxxxxxxxxxxxxxxx
I hope this is not out of topic. If yes, sorry and tell me the correct
group.
We're using BulkInsert to load xml files in a SQLExpress DB.
In one XML field we may have whitespace" " but when the file is loaded,
in
the DB we have null value for this field: we want to have emptyspace
also
in
the DB. Do you know if there are settings or parameters to solve this
problem?

Thanks a lot!

--

Rubén Garrigós
Solid Quality Mentors





.



Relevant Pages

  • Re: Converting BTS 2002 Flatfile XDR to 2004 XSD
    ... We wrote our own tool for FF XDR conversion to FF XSD. ... I have a BizTalk 2002 XDR schema for parsing a flat file. ... Line in the BTS 2002 editor cant be found in BTS 2004. ... to generate these extra linefeeds? ...
    (microsoft.public.biztalk.general)
  • Re: SQL XMLBulkLoad not Loading
    ... Looks like you still have a bad schema. ... Have you tried the XSD inference tool to genereate an XSD? ... > Hi Irwin - ... > be missing a few elements.....I used the MS SQL Mapper to create an XDR ...
    (microsoft.public.sqlserver.xml)
  • A simple Problem with XDR and xsd
    ... i had some XSD in my virtual directory when i query my xsd then for simle xsd ... problem i am facing with my xdr the xdr below does not works ...
    (microsoft.public.sqlserver.xml)

Loading