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 - 如何将变量和查询结果写入文本文件


- 如何将 SonarQube 6.7 从 MySQL 迁移到 postgresql 2022-01-01
- 在SQL中,如何为每个组选择前2行 2021-01-01
- 如何使用 pip 安装 Python MySQLdb 模块? 2021-01-01
- 如何将 Byte[] 插入 SQL Server VARBINARY 列 2021-01-01
- 以一个值为轴心,但将一行上的数据按另一行分组? 2022-01-01
- 更改自动增量起始编号? 2021-01-01
- SQL 临时表问题 2022-01-01
- 使用 Oracle PL/SQL developer 生成测试数据 2021-01-01
- 导入具有可变标题的 Excel 文件 2021-01-01
- 远程 mySQL 连接抛出“无法使用旧的不安全身份验证连接到 MySQL 4.1+"来自 XAMPP 的错误 2022-01-01