--开启xp_cmdshell
sp_configure ‘show advanced options’, 1;
GO
RECONFIGURE;
GO
sp_configure ‘xp_cmdshell’, 1; --Switch on specific functionality
GO
RECONFIGURE;
GO


--Tab作为行分隔符,\n作为断行符 导出到H盘
EXECUTE master.dbo.xp_cmdshell 'bcp "SELECT TOP 20 PERCENT * FROM MyDB.dbo.table_name" queryout H:\table_name.dat -c -T'

 

 

相关文章:

  • 2021-06-10
  • 2021-04-02
  • 2022-01-09
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-10-24
  • 2021-11-26
  • 2021-09-13
  • 2021-08-24
  • 2022-02-20
  • 2021-06-25
相关资源
相似解决方案