SynsorIT
asked on
Import XML file into SQL 2000
Greetings,
I searched the tried to find an existing answer that could help but due to my limited knowledge of importing xml could not find a solution that would work.
Our engineers use solidworks which when a part is "approved" will generate an XML file with information regarding the part.
What i am looking for is either a sql procedure or code for visual studio that will take the values in the XML file and import them into a temporary table in SQL 2000.
The included XML file is an example of what is exported by Solidworks, at this point we are only concerned with the part itself and not the rest of the XML which is the BOM for the part. Everything under <references> is the bom which we do not need at this point.
I only need the following attributes from the first part (part itself) to be added as columns in the SQL temp table.
FDESCRIPT
FSTDMEMO
FREV
Vendor
FPRODCL
FPARTNO
FGROUP
Stock Usage
Stock Description
Stock Number
FSOURCE
FMEASURE
Please let me know if i missed any important information and thank you all very much!!!
TESTASM1-X.XML
I searched the tried to find an existing answer that could help but due to my limited knowledge of importing xml could not find a solution that would work.
Our engineers use solidworks which when a part is "approved" will generate an XML file with information regarding the part.
What i am looking for is either a sql procedure or code for visual studio that will take the values in the XML file and import them into a temporary table in SQL 2000.
The included XML file is an example of what is exported by Solidworks, at this point we are only concerned with the part itself and not the rest of the XML which is the BOM for the part. Everything under <references> is the bom which we do not need at this point.
I only need the following attributes from the first part (part itself) to be added as columns in the SQL temp table.
FDESCRIPT
FSTDMEMO
FREV
Vendor
FPRODCL
FPARTNO
FGROUP
Stock Usage
Stock Description
Stock Number
FSOURCE
FMEASURE
Please let me know if i missed any important information and thank you all very much!!!
TESTASM1-X.XML
ASKER
Solidoworks outputs the XML file as "partnumber".xml
Is there a way to modify this code to look at the xml files in a specific folder?
Example;
We have a folder y:/_BOMexport
1000146.xml
1000690.xml
1000710.xml
and so on
There could be hundreds of these a day. Ideally we would want to read all files in the y:/_BOMexport folder and delete them after reading into sql.
Thank you!!!
Is there a way to modify this code to look at the xml files in a specific folder?
Example;
We have a folder y:/_BOMexport
1000146.xml
1000690.xml
1000710.xml
and so on
There could be hundreds of these a day. Ideally we would want to read all files in the y:/_BOMexport folder and delete them after reading into sql.
Thank you!!!
For many reasons, but foremost security and performance, you are better off passing the Xml files using a front-end app written in VB or .NET rather then using MS SQL Server to do this. That is not to say that you cannot do it using something like OPENROWSET() or (God forbid) the sp_OA* funtions, it is just that for your own sanity, don't do that, MS SQL Server was never intended for that purpose and using it as if it was MS Access is a very bad idea.
ASKER
So would best practice go something like this?
.net
- grab xml file from y:/_bomexport
- pass xml to temporary table in SQL (or should it pass the xml directly into the "item master" table)
- take xml data in SQL temp table and divide into columns and insert into "item master" table
- delete xml file from y:/bomexport
- repeat for all files in y:/bomexport
Thanks for your help, i am very new to this but am learning!!!
.net
- grab xml file from y:/_bomexport
- pass xml to temporary table in SQL (or should it pass the xml directly into the "item master" table)
- take xml data in SQL temp table and divide into columns and insert into "item master" table
- delete xml file from y:/bomexport
- repeat for all files in y:/bomexport
Thanks for your help, i am very new to this but am learning!!!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Open in new window