how to export named BOM to XML file?

-How to export named BOM to XML file, when i change state?
-How to link named BOM to SQL server?

Thx
wlySolidworksSolidworks Pdm enterprise Pdm