exec master..xp_cmdshell 'bcp "select c.Category_Title as 标题,p.Category_Title as 所属分类 from ltblGameStore..tbl_Category as c left join ltblGameStore..tbl_Category as p on c.Category_ParentId = p.Category_Id" queryout D:\test\Temp.xls  -c -q -S"192.168.100.18" -U"sa" -P"A_123"'

数据库使用:master

查询的sql语句中的表名要写成:数据库名..表名

导出的文件要放到文件夹下,并给这个文件夹Everyone权限

相关文章:

  • 2021-10-17
  • 2022-12-23
  • 2021-08-05
  • 2021-12-20
  • 2021-12-14
  • 2021-12-04
猜你喜欢
  • 2021-09-02
  • 2021-05-16
  • 2021-05-22
  • 2021-12-30
相关资源
相似解决方案