Solved

CLR "save to file" procedure erroring in SQL Server 2005 SP3

Posted on 2010-11-17
1
1,037 Views
Last Modified: 2012-05-10
I'm using a CLR procedure (which I've called "writetofile") to allow SQL server to generate xml and save to file.   The procedure is based on the code at http://www.sqldbatips.com/showarticle.asp?ID=23

I'm using the procedure in a query which produces about 20 lines of XML per record retrieved and then saves the XML document to file.  The query works fine if I initially select the top 1,000 records (to produce around 20,000 lines of XML) but errors on around 10,000 records or more.  My results need to include around 60,000 records.  The query errors with the following error message:

Msg 6532, Level 16, State 49, Procedure writetofile, Line 0
.NET Framework execution was aborted by escalation policy because of out of memory.
System.Threading.ThreadAbortException: Thread was being aborted.
System.Threading.ThreadAbortException:
   at System.Data.SqlTypes.SqlChars.get_Value()
   at System.Data.SqlServer.Internal.XvarWlobStream.GetCharArray()
   at System.Data.SqlServer.Internal.XvarWlobStream.GetString()



I've found a hotfix which looks relevant to this but cannot install it as I have SP3 and it is designed for SP1.  See the following link for details of the hotfix:  http://support.microsoft.com/kb/928083

I've downloaded the Hotfix (several distinct executables which need to be installed in order).
When it comes to installing the hotfix, I'm falling at the first hurdle - when I run the first executable, it advises that is designed for SP1 and my version of Sql Server 2005 is at SP3.  It suggests I download a version of the hotfix for SP3. - which I cannot locate.


Any ideas for how I'd get some solution to leave me able to write a large amount of text (XML) to file as part of a SQL procedure?
0
Comment
Question by:Beamson
1 Comment
 
LVL 51

Accepted Solution

by:
Mark Wills earned 250 total points
ID: 34161607
check : http://support.microsoft.com/kb/969962 
in particular : try giving more memory to SQL CLR by increasing the 'MemToLeave' or 'Non buffer pool memory' to 384 MB
can also check using CLR profiler : http://msdn.microsoft.com/en-us/library/ff650691.aspx

alternatively, create a new stored procedure and emulate your own "queue" by populating say a thousand rows at a time and appending to your output file, or some other logical grouping (unless it must be the one xml file)

0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Testing connection to sql 7 60
SQL Merige returns error code when updating 15 53
Error when saving to sql table a '/' 5 29
Find results from sql within a time span 11 34
Introduction This article will provide a solution for an error that might occur installing a new SQL 2005 64-bit cluster. This article will assume that you are fully prepared to complete the installation and describes the error as it occurred durin…
In SQL Server, when rows are selected from a table, does it retrieve data in the order in which it is inserted?  Many believe this is the case. Let us try to examine for ourselves with an example. To get started, use the following script, wh…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

825 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question