问题描述
如何使用 T-SQL、变量值和查询结果写入文本文件,我想实际继续追加.
How do I write using T-SQL, variable values and query results to a text file, I want to actually keep appending.
推荐答案
您可以使用 SQL CLR 将您想要的任何内容写入文件.您可以自己编写代码,也可以使用 SQL# 库(我是作者,它不是免费的——对于这个函数——但也不贵)并使用 File_WriteFile 函数写出文本.它允许附加数据.该库对于大多数函数是免费的,但对于文件系统函数则不是.可以在以下位置找到:http://www.SQLsharp.com/
You can use SQL CLR to write whatever you want out to a file. You can either code this yourself or you can use the SQL# library (I am the author and it is not free -- for this function -- but not expensive either) and use the File_WriteFile function to write out the text. It allows for appending data. The library is free for most functions but not for the File System functions. It can be found at: http://www.SQLsharp.com/
如果你想尝试自己编码,我发现这个例子是我认为你要求的基本概念:http://www.mssqltips.com/tip.asp?tip=1662
If you want to try coding this yourself, I found this example which is the basic concept I think you are asking for: http://www.mssqltips.com/tip.asp?tip=1662
这篇关于SQL Server - 如何将变量和查询结果写入文本文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!