how to write the contents of a nvarchar(max) to a text file

  • I want to write the contents of a nvarchar(max) variable to a text file through sql server stored procedure. How can i do that...

  • There isn't a good way to do this, but there are ways. You can shell out and use SQLCMD or bcp to pull data out. You can setup an SSIS package and job and then have that send it out, but basically you need an application of some sort to do this. SQL Server doesn't natively talk to the file system.

    Could use some VBScript or powershell as well to pull data out.

  • The problem I've run into is that you can't see the entire thing depending on what you use to see the data.

    Have you given any thought to using Excel or Word to query the data and then display it however you want in your office app of choice?

    -Luke.

    To help us help you read this[/url]For better help with performance problems please read this[/url]

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply