如何Sql数据库服务器中一个SQL查询结果导出到客户端的一个本地Excel文件里???急!!!!在线!
EXEC master..xp_cmdshell 'bcp "SELECT au_fname,au_lname FROM pubs..authors ORDER BY au_lname " queryout "C:\test.xls " /c -S "Hokkai " /U "sa " -P " " '
这句SQL只能把EXCEL导出到数据库服务器所在的机器上,
如何才能把EXCEL文件导出到客户端呢?
请高手帮忙!!!!
[解决办法]
exec xp_cmdshell 'net use z: \\des-dev3\shareddocs " " /user:des-dev3\rfq '
EXEC master..xp_cmdshell 'bcp "SELECT au_fname,au_lname FROM pubs..authors ORDER BY au_lname " queryout "Z:\test.xls " /c -S "SERVER " /U "sa " -P ", " '
exec xp_cmdshell 'net use z: /delete '