Showing posts with label wrong. Show all posts
Showing posts with label wrong. Show all posts

Tuesday, March 27, 2012

Bulk Load - In a Panic Need Help... PLEASE!

Please help I am new to XML and Schema will someone look this over and tell
me what I am doing wrong'
Ok, I receive inventory updates once a w from my vendor in the following
format: (Obviously trimmed down)
<?xml version="1.0" encoding="UTF-8"?>
<AvailableBatch>
<Date>08/14/2005</Date>
<Available>
<Sku>40</Sku>
<Part>10 </Part>
<Location>20</Location>
<Qty>0</Qty>
<Time>07:20:09</Time>
<Detail>
<Desc>TIGHTS, MENS</Desc>
<Price>14.90</Price>
</Detail>
</Available>
<Available>
<Sku>REPEAT OVER 10000 TIMES</Sku>
<Part>1REPEAT OVER 10000 TIMES</Part>
<Location>REPEAT OVER 10000 TIMES</Location>
<Qty>REPEAT OVER 10000 TIMES</Qty>
<Time>REPEAT OVER 10000 TIMES</Time>
<Detail>
<Desc>REPEAT OVER 10000 TIMES</Desc>
<Price>REPEAT OVER 10000 TIMES</Price>
</Detail>
</Available>
</AvailableBatch>
tonight I picked through tutorials to try to setup my schema file... I know
this is wrong... Im just at a loss as to why? Now please keep in mind that
the above xml file only has the date once and then repeats the "<Available>"
section thousands of times:
Schema File:
<?xml version="1.0" encoding="utf-8" ?>
<xs:schema id="XMLSchema"
targetNamespace="http://tempuri.org/XMLSchema.xsd"
elementFormDefault="qualified"
xmlns="http://tempuri.org/XMLSchema.xsd"
xmlns:mstns="http://tempuri.org/XMLSchema.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="AvailableBatch">
<xs:complexType>
<xs:sequence>
<xs:element name ="Date">
<xs:complexType>
<xs:sequence id="Available">
<xs:element name ="Sku" type ="xs:string" maxOccurs
="unbounded"/>
<xs:element name ="Part" type ="xs:string" maxOccurs
="unbounded"/>
<xs:element name ="Location" type ="xs:string" maxOccurs
="unbounded"/>
<xs:element name ="Qty" type ="xs:string" maxOccurs
="unbounded"/>
<xs:element name ="Time" type ="xs:string" maxOccurs
="unbounded"/>
<xs:sequence id ="Detail">
<xs:element name ="Description" type ="xs:string" maxOccurs
="unbounded"/>
<xs:element name ="Price" type ="xs:string" maxOccurs
="unbounded"/>
</xs:sequence>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
I have a tuesday deadline to get this data into my data base... can someone
please give me a hand?
I really appreciate whoever can take their time to help me... You have no
idea how much I appreciate it!
AaronI did find a schema generator: Would this be correct or is this wrong?
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
<xs:element name="AvailableBatch">
<xs:complexType>
<xs:sequence>
<xs:element ref="Date"/>
<xs:element maxOccurs="unbounded" ref="Available"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Date" type="xs:string"/>
<xs:element name="Available">
<xs:complexType>
<xs:sequence>
<xs:element ref="Sku"/>
<xs:element ref="Part"/>
<xs:element ref="Location"/>
<xs:element ref="Qty"/>
<xs:element ref="Time"/>
<xs:element ref="Detail"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Sku" type="xs:integer"/>
<xs:element name="Part" type="xs:string"/>
<xs:element name="Location" type="xs:integer"/>
<xs:element name="Qty" type="xs:integer"/>
<xs:element name="Time" type="xs:NMTOKEN"/>
<xs:element name="Detail">
<xs:complexType>
<xs:sequence>
<xs:element ref="Desc"/>
<xs:element minOccurs="0" ref="Weight"/>
<xs:element minOccurs="0" ref="Price"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Desc" type="xs:string"/>
<xs:element name="Weight" type="xs:decimal"/>
<xs:element name="Price" type="xs:decimal"/>
</xs:schema>
Aaron C wrote:
>Please help I am new to XML and Schema will someone look this over and tell
>me what I am doing wrong'
>Ok, I receive inventory updates once a w from my vendor in the following
>format: (Obviously trimmed down)
><?xml version="1.0" encoding="UTF-8"?>
><AvailableBatch>
> <Date>08/14/2005</Date>
> <Available>
> <Sku>40</Sku>
> <Part>10 </Part>
> <Location>20</Location>
> <Qty>0</Qty>
> <Time>07:20:09</Time>
> <Detail>
> <Desc>TIGHTS, MENS</Desc>
> <Price>14.90</Price>
> </Detail>
> </Available>
><Available>
> <Sku>REPEAT OVER 10000 TIMES</Sku>
> <Part>1REPEAT OVER 10000 TIMES</Part>
> <Location>REPEAT OVER 10000 TIMES</Location>
> <Qty>REPEAT OVER 10000 TIMES</Qty>
> <Time>REPEAT OVER 10000 TIMES</Time>
> <Detail>
> <Desc>REPEAT OVER 10000 TIMES</Desc>
> <Price>REPEAT OVER 10000 TIMES</Price>
> </Detail>
> </Available>
></AvailableBatch>
>tonight I picked through tutorials to try to setup my schema file... I kno
w
>this is wrong... Im just at a loss as to why? Now please keep in mind tha
t
>the above xml file only has the date once and then repeats the "<Available>
"
>section thousands of times:
>Schema File:
><?xml version="1.0" encoding="utf-8" ?>
><xs:schema id="XMLSchema"
> targetNamespace="http://tempuri.org/XMLSchema.xsd"
> elementFormDefault="qualified"
> xmlns="http://tempuri.org/XMLSchema.xsd"
> xmlns:mstns="http://tempuri.org/XMLSchema.xsd"
> xmlns:xs="http://www.w3.org/2001/XMLSchema">
> <xs:element name="AvailableBatch">
> <xs:complexType>
> <xs:sequence>
> <xs:element name ="Date">
> <xs:complexType>
> <xs:sequence id="Available">
> <xs:element name ="Sku" type ="xs:string" maxOccurs
>="unbounded"/>
> <xs:element name ="Part" type ="xs:string" maxOccurs
>="unbounded"/>
> <xs:element name ="Location" type ="xs:string" maxOccurs
>="unbounded"/>
> <xs:element name ="Qty" type ="xs:string" maxOccurs
>="unbounded"/>
> <xs:element name ="Time" type ="xs:string" maxOccurs
>="unbounded"/>
> <xs:sequence id ="Detail">
> <xs:element name ="Description" type ="xs:string" maxOccurs
>="unbounded"/>
> <xs:element name ="Price" type ="xs:string" maxOccurs
>="unbounded"/>
> </xs:sequence>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
></xs:schema>
>I have a tuesday deadline to get this data into my data base... can someon
e
>please give me a hand?
>I really appreciate whoever can take their time to help me... You have no
>idea how much I appreciate it!
>Aaron|||Now that I have my schema and my xml file: Where do I go from here to
bulkload my Sql Dataase?
In over my head, lol
Aaron
Aaron C wrote:
>I did find a schema generator: Would this be correct or is this wrong?
><?xml version="1.0" encoding="UTF-8"?>
><xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
>elementFormDefault="qualified">
> <xs:element name="AvailableBatch">
> <xs:complexType>
> <xs:sequence>
> <xs:element ref="Date"/>
> <xs:element maxOccurs="unbounded" ref="Available"/>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> <xs:element name="Date" type="xs:string"/>
> <xs:element name="Available">
> <xs:complexType>
> <xs:sequence>
> <xs:element ref="Sku"/>
> <xs:element ref="Part"/>
> <xs:element ref="Location"/>
> <xs:element ref="Qty"/>
> <xs:element ref="Time"/>
> <xs:element ref="Detail"/>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> <xs:element name="Sku" type="xs:integer"/>
> <xs:element name="Part" type="xs:string"/>
> <xs:element name="Location" type="xs:integer"/>
> <xs:element name="Qty" type="xs:integer"/>
> <xs:element name="Time" type="xs:NMTOKEN"/>
> <xs:element name="Detail">
> <xs:complexType>
> <xs:sequence>
> <xs:element ref="Desc"/>
> <xs:element minOccurs="0" ref="Weight"/>
> <xs:element minOccurs="0" ref="Price"/>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> <xs:element name="Desc" type="xs:string"/>
> <xs:element name="Weight" type="xs:decimal"/>
> <xs:element name="Price" type="xs:decimal"/>
></xs:schema>
>
>[quoted text clipped - 80 lines]
Message posted via http://www.webservertalk.com|||You have to specify the annotations to describe the mapping between your Xml
and relatinal structures.
Check out this link:
http://msdn.microsoft.com/library/d...ations_0gqb.asp
Bertan ARI
This posting is provided "AS IS" with no warranties, and confers no rights.
"Aaron C via webservertalk.com" <forum@.webservertalk.com> wrote in message
news:52DF026D67AC8@.webservertalk.com...
> Now that I have my schema and my xml file: Where do I go from here to
> bulkload my Sql Dataase?
> In over my head, lol
> Aaron
>
> Aaron C wrote:
>
> --
> Message posted via http://www.webservertalk.com

Sunday, March 25, 2012

Bulk Insert ZERO rows returned...

I have poured thru notes, sites, etc. and can't seem to figure what I might be doing wrong - which most likely is something very easy.

BULK INSERT

dbo.tbCheckpoint

FROM 'c:\inetpub\wwwroot\upload\maxie_task_aging.csv'

WITH

( DATAFILETYPE = 'char', FIELDTERMINATOR = ', ',

FIRSTROW = 3, KEEPNULLS, ROWTERMINATOR = '\t\n')

I am doing a bulk insert where I am pulling from .csv but the msg I get when running it is

(0 row(s) affected)


There is data in the file, it starts on the 3rd row and terminators are set correctly.

Any thoughts?

Moving to the transact-SQL forum.|||Have you checked to see if the .csv file ends with a carriage return/line feed? I have seen cases where the insert would fail because the csv, as a whole, was not terminated properly. It's definitely worth a "look see", so to speak. If the file is missing a carriage return, add it, then try the import again.|||Thanks! That was it.