title: save huge xml from sql to web
body: <p>In sqlserver I have a function which generates a complex xml of all products with several tables joined: location, suppliers, orders etc.</p>
  
  <p>No problem in that, it runs in 68 sec and produces around 450MB.
  It should only be called occationally during migration to another server, so it doesn't matter it takes some time.</p>
  
  <p>I want to make this available for download over webserver.</p>
  
  <p>I've tried some variations of this in classic asp:</p>
  
  <pre><code>Response.Buffer = false 
  set rs=conn.execute("select cast(dbo.exportXML() as varchar(max)) as res")
  response.write rs("res")
  </code></pre>
  
  <p>But I just get a standard </p>
  
  <blockquote>
    <p>An error occurred on the server when processing the URL. Please contact the system administrator.
    If you are the system administrator please click here to find out more about this error.</p>
  </blockquote>
  
  <p>Not my usual custom 500-errorhandler, so I'm not sure how to find the error.</p>
  
  <p>The problem is in response.write rs("res"), if i just do </p>
  
  <pre><code>temp = rs("res")
  </code></pre>
  
  <p>the script runs, but displays nothing of cause; if I then</p>
  
  <pre><code>response.write temp
  </code></pre>
  
  <p>I get the same failure.</p>
  
  <p>So the problem is writing such a ling string.</p>
  
  <p>Can I save the file from tsql directly; and run the job periodically from sql agent?</p>