1

Topic: Result of performance of stored procedure SQL in a XML file

I have a stored procedure, approximately such type:
SELECT 0.1 as "@version";
(
SELECT
MessageID,
MsgDateTime,
MessageType,
MsgSenderID,
MsgReceiverID
FOR XML PATH ("), TYPE, ELEMENTS
) AS MessageHeader,
(
SELECT
DeliveryNoteType;
DocumentID;
CreationDateTime;
FunctionCode
FOR XML PATH ("), TYPE, ELEMENTS) AS DeliveryNote
FROM CS_Waybill
FOR XML PATH (' BLRWBL ')
I.e. on an output I receive a XML file with the groupings necessary to me.
Question in that it is necessary to write down given results in a xml-file not SQL server means, and stored procedure means (to set in parameter). Still it is necessary to add type title <? xml version = "1.0" encoding = "UTF-8"?>.

2

Re: Result of performance of stored procedure SQL in a XML file

Viktor78 wrote:

I.e. on an output I receive a XML file with the groupings necessary to me.
Question in that it is necessary to write down given results in a xml-file not SQL server means, and stored procedure means (to set in parameter). Still it is necessary to add type title <? xml version = "1.0" encoding = "UTF-8"?>.

On an output of performance of procedure you receive at all a XML file. Therefore do not say lies, and show the code where you save it kindly in a file. And here depending on it we will solve your problem.
Though, of course, the general - to add this business in the beginning in the form of a line. But with such heap of nuances that is not necessary.

3

Re: Result of performance of stored procedure SQL in a XML file

What code? There is a DB, there is a stored procedure obtaining the data from a DB and groups them (i.e. nodes and  xml). It is necessary to place results of performance of stored procedure in a xml-file.

4

Re: Result of performance of stored procedure SQL in a XML file

Viktor78;
Well so place.

Viktor78 wrote:

it is necessary to write down given results in a xml-file not SQL server means, and stored procedure means (to set in parameter).

Are assured that it is necessary to do it in , thus NOT by SQL server means.
You generally represent as it is possible to fulfill 2 contradicting requirements?
I here was not present.
But I can suggest to study Sql Server Integration Services (SSIS), and in particular MS a Visual Studio SQL Server + Sql Server Data Tools for Visual Studio which allow to create packets SSIS.

Viktor78 wrote:

Still it is necessary to add type title <? xml version = "1.0" encoding = "UTF-8"?>.

It is never necessary. And by operation with MS SQL XML "stored procedure means" also it is harmful.

5

Re: Result of performance of stored procedure SQL in a XML file

It is possible to resolve functions of operation with COM objects sp_oa... (Are by default disconnected) and save through object Scripting. FileSystemObject