SQL for XML function to file
Posted on 2009-04-20
I currently am using the function below to deliver a bill of material from the given part number to an XML file. As the function stands, I have to manually save the xml file.
I want to develop a VB windows program so that the end user can export the XML BOM for other uses.
What is the best way to attack this? Is there a way to do it in the function? Or should this be handled from the VB side? If so, How?
Any help would be greatly appreciated.
ALTER FUNCTION [dbo].[GetPartsSubTree](@PartNumberID nvarchar(50))
(SELECT CorpComponent AS "@ID",
Description AS "Description",
Drawing as "Drawing",
EBOMParent as "Parent",
Qty as "Qty",
NSN as "NSN",
ORDER BY CorpComponent
FOR XML PATH('PART'),ROOT('SUBPARTS'),TYPE)