SQL Server- How to write variables and query results to Text file?(SQL Server - 如何将变量和查询结果写入文本文件?)
问题描述
如何使用 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 - 如何将变量和查询结果写入文本文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:SQL Server - 如何将变量和查询结果写入文本文件


基础教程推荐
- oracle区分大小写的原因? 2021-01-01
- 在 MySQL 中:如何将表名作为存储过程和/或函数参数传递? 2021-01-01
- 如何根据该 XML 中的值更新 SQL 中的 XML 2021-01-01
- 什么是 orradiag_<user>文件夹? 2022-01-01
- 二进制文件到 SQL 数据库 Apache Camel 2021-01-01
- 表 './mysql/proc' 被标记为崩溃,应该修复 2022-01-01
- MySQL 中的类型:BigInt(20) 与 Int(20) 2021-01-01
- 在多列上分布任意行 2021-01-01
- mysql选择动态行值作为列名,另一列作为值 2021-01-01
- 如何在 SQL 中将 Float 转换为 Varchar 2021-01-01