有时候我们需要通过SQL语句来拷贝服务器上的文件,这时我们可以通过执行xp_cmdshell   来达到拷贝文件的效果如下:

EXEC  xp_cmdshell   'copy   D:\11.txt   C:\11.txt'

为了可以执行xp_cmdshell   我们必须enable xp_cmdshell  .

打开方法如下:

打开Sql server 2005 surface area configuration

选择 xp_cmdshell   然后在enable xp_cmdshell   前打上勾就可以了.如下图:

SQL 复制硬盘文件.

 

是不是很简单呢?:)

相关文章:

  • 2021-07-13
  • 2022-12-23
  • 2022-12-23
  • 2021-07-18
  • 2021-09-17
  • 2021-12-14
  • 2021-11-29
  • 2022-02-10
猜你喜欢
  • 2021-05-19
  • 2021-09-11
  • 2021-12-07
  • 2022-02-10
  • 2021-04-09
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案