Re: XSD and BulkInsert



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

  • XML Documents in Word
    ... I am possibly posting to a wrong group but this one just seems to be closest ... I created an XSD schema to be used with a Microsoft Word document that is, ... So I have this XML file and now want to change the data inside the elements ...
    (microsoft.public.office.developer.automation)
  • RE: Is XSD schema flexible?
    ... > configuration and other data in the XML file. ... I want each time app opens XML ... > file to validate the file against scheme. ... Should I use XSD schema validation at all? ...
    (microsoft.public.dotnet.xml)
  • what is tempuri.org?
    ... i created a sample xml file describing mailing addresses & used the ... generate xsd schema from the menu. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: XML Documents in Word
    ... What I was trying to do is this: I have an xml file ... that was created in word with an xsd schema. ... > It just seems a bit strange that you'd populate in the Word object model, ... > rather than using XML to populate the closed file... ...
    (microsoft.public.office.developer.automation)

Loading