Business Requirement:
Automatically create an XML file from MSSQL7. The XML file must be readable by Excel 2007.
Here is what I have done:
1) I saved the following statement to myscript.sql:
use Mini_DW
go
select contractor_name,cid from CONTRACTOR
for XML AUTO
2)I ran this statement from the command promt:
osql -S cpiblade7 -U -h-1 -n -i c:\myscript.sql -o c:\myxml.xml
This successfully creates myxml.xml
3) Use Excel 2007 XML Data Import proces to Open myxml.xml
Excel returns this error:Invalid file reference. The path to the file is invalid or one or more of the referenced schema could not be found.
[/color red]
Here is the first few lines on myxml.xml
<CONTRACTOR contractor_name="3D Datacom " cid="1"/><CONTRACTOR contractor_na
me="568Systems, Inc" cid="2"/><CONTRACTOR contractor_name="A&H Comm
unications, Inc." cid="3"/><CONTRACTOR contractor_name="ABC Electric
" cid="4"/><CONTRACTOR contractor_name="Able Communications" cid="5"/><
CONTRACTOR contractor_name="Access Communications Inc" cid="7"/><CONTRA
CTOR contractor_name="Access Data Network Solutions Inc.(Access DNSI)"
cid="8"/><CONTRACTOR contractor_name="ACI Communications" cid="9"/>
I also noticed that the last line of the xml file doesn't seem to have the correct end tag:
<CONTRACTOR contractor_name="Boe-Tel Company" c
id="34"/><CONTRACTOR contractor_name=" [/color red]
What am I doing wrong? I'm familiar with HTML but have limited experience on XML.
So sorry we're still stuck in the dark ages -- MSSQL7.
Thank you much for your help.
Automatically create an XML file from MSSQL7. The XML file must be readable by Excel 2007.
Here is what I have done:
1) I saved the following statement to myscript.sql:
use Mini_DW
go
select contractor_name,cid from CONTRACTOR
for XML AUTO
2)I ran this statement from the command promt:
osql -S cpiblade7 -U -h-1 -n -i c:\myscript.sql -o c:\myxml.xml
This successfully creates myxml.xml
3) Use Excel 2007 XML Data Import proces to Open myxml.xml
Excel returns this error:Invalid file reference. The path to the file is invalid or one or more of the referenced schema could not be found.
[/color red]
Here is the first few lines on myxml.xml
<CONTRACTOR contractor_name="3D Datacom " cid="1"/><CONTRACTOR contractor_na
me="568Systems, Inc" cid="2"/><CONTRACTOR contractor_name="A&H Comm
unications, Inc." cid="3"/><CONTRACTOR contractor_name="ABC Electric
" cid="4"/><CONTRACTOR contractor_name="Able Communications" cid="5"/><
CONTRACTOR contractor_name="Access Communications Inc" cid="7"/><CONTRA
CTOR contractor_name="Access Data Network Solutions Inc.(Access DNSI)"
cid="8"/><CONTRACTOR contractor_name="ACI Communications" cid="9"/>
I also noticed that the last line of the xml file doesn't seem to have the correct end tag:
<CONTRACTOR contractor_name="Boe-Tel Company" c
id="34"/><CONTRACTOR contractor_name=" [/color red]
What am I doing wrong? I'm familiar with HTML but have limited experience on XML.
So sorry we're still stuck in the dark ages -- MSSQL7.
Thank you much for your help.