--sql生成文本文件1
declare @cmd varchar(8000)
declare @info varchar(8000)
set @info = 'this is test content'
set @cmd = 'echo ' + @info +' >>c:\abc.txt' --'>>'是在已有同名文件中追加内容,'>'是重新生成文件覆盖原来的内容
exec master.dbo.xp_cmdshell @cmd


--sql生成文本文件2
exec master..xp_cmdshell 'bcp "select * from sysfiles" queryout "C:\abc.txt" -T -c -t'

相关文章:

  • 2022-01-11
  • 2021-11-19
  • 2021-12-24
  • 2021-12-28
  • 2022-01-16
  • 2022-12-23
  • 2021-12-04
  • 2021-09-03
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-06
  • 2021-12-14
  • 2021-11-17
相关资源
相似解决方案