Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2010-11-17
1
Medium Priority
?
1,049 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 1000 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

This article will describe one method to parse a delimited string into a table of data.   Why would I do that you ask?  Let's say that you need to pass multiple parameters into a stored procedure to search for.  For our sake, we'll say that we wa…
If you having speed problem in loading SQL Server Management Studio, try to uncheck these options in your internet browser (IE -> Internet Options / Advanced / Security):    . Check for publisher's certificate revocation    . Check for server ce…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…

916 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