SQL SERVER - shan

07-Dec-07 06:31:37
I have created an XML file in SQL server 2000. I need to store this filed under a folder as an XML file. Following is the code structure.



CREATE PROCEDURE [sp_TestXML2]

@XMLOUT		varchar(8000)		OUTPUT		-- this time use an output parameter



AS

DECLARE

@XML 		varchar(8000),

@strRow			varchar(50),

@RowId			int,

@Rowcount		int



Begin --Main



SELECT @Rowcount = count(*) FROM SNP_ORS_Table_Create_XML(NOLOCK)

SET @XML = '<?xml version="1.0" encoding="UTF-8" ?>'

SET @XML = @XML + '<tma>'

SET @XML = @XML + '<tma_header>'

SET @XML = @XML + '<conversationid></conversationid>'

SET @XML = @XML + '<transaction>TRAN29D</transaction>'

SET @XML = @XML + '<sourcecountry>XXXX</sourcecountry>'

SET @XML = @XML + '<sourcecompany>YYYYY</sourcecompany>'

SET @XML = @XML + '<sourcesystem>ZZZZ</sourcesystem>'

SET @XML = @XML + '</tma_header>'

SET @XML = @XML + '<tma_body>'

SET @XML = @XML + '<bankfiletype>NB</bankfiletype>'

SET @XML = @XML + '<generateddate>28-Nov-07</generateddate>'

SET @XML = @XML + '<records>'

While (@Rowcount > 0)

BEGIN

Set Rowcount  1

Select @RowId = recId,@strRow = record From SNP_ORS_Table_Create_XML(NOLOCK)

SET @XML = @XML + '<record>' + LTRIM(RTRIM(@strRow)) + '</record>'

Delete From SNP_ORS_Table_Create_XML Where recId = @RowId

Set @Rowcount = @Rowcount-1

END

SET @XML = @XML + '</records>'

SET @XML = @XML + '</tma_body>'

SET @XML = @XML + '<tma_fault>'

SET @XML = @XML + '<systemfault/>'

SET @XML = @XML + '<applicationfault/>'

SET @XML = @XML + '</tma_fault>'

SET @XML = @XML + '</tma>'

-- output the xml as a single parameter

SELECT @XMLOUT = LTRIM(RTRIM(@XML))

End --Main



I need to store @XML as an xml file under any folder. Please help
reply
 

SQL SERVER
promotion
Silverlight    WPF    WCF    WWF    LINQ   
JavaScript    AJAX    ASP.NET    XAML   
C#    VB.NET    VB 6.0    GDI+    IIS    XML   
.NET Generics    Anonymous Methods    Delegate   
Visual Studio .NET    Expression Blend    Virus   
Windows Vista    Windows XP    Windows Update   
Windows 2003 Server    Windows 2008 Server   
SQL Server    Microsoft Excel    Microsoft Word   
SharePoint    BizTalk    Virtual Earth   
.NET Compact Framework    Web Service   

"Everything" RSS / ATOM Feed Parser
How to send and receive messages through message queuing in .Net
How to Read text file as database
SQL Server 2005 Paging Performance Tip
Display code of web page.
Fully Scalable Excel File Importer class for .net using Microsoft Jet driver
Generic Chart Color Manager class that can be used for any charts
Helper class to style the infragistics wingrid
Using Reflection to detemine as Assembly Info in and out.
Helper class to play with Window (Owners and position)
Resolving displayname from the culture using the XmlLanguage and LanguageSpecificStringDictionary class