I need to create an XML document from a SELECT and store that in a folder on the network.
I have a basic select statement, works fine.
I Then add at the bottom - "FOR XML PATH(''), ROOT('SALES')" - which again works fine when I execute.
If I create a view ( without the XML statement ) - that works fine and creates a view.
If I add the "FOR XML PATH(''), ROOT('SALES')" at the end and execute the "ALTER VIEW", I get the following message.
Msg 4511, Level 16, State 1, Procedure View_SLG_FinanceForecast_ActualSales_XML, Line 5
Create View or Function failed because no column name was specified for column 1.
Should I create the view as XML format - or should I use a stored procedure to drop the output out as XML via BCP ?
Any help would be appreciated.
SQL 2008 DBA/DBD - MCTS/MCITP
Please don't trust me, test the solutions I give you before using them.