请问SQL怎么导出数据表,或者是怎么引用它。

来源:百度知道 编辑:UC知道 时间:2024/07/07 21:00:57

将以下放到查询分析器执行,其它程序使用可写成过程调用
exec master..xp_cmdshell 'bcp " select * from hrm..t_emp where leave_flag=''N'' " queryout d:\emp.txt -c -U "test" -P
"123"' --将数据库hrm中 表t_emp导出到d:\emp.txt ,即是导出成txt文件

exec master..xp_cmdshell 'bcp " select * from hrm..t_emp where leave_flag=''N'' " queryout d:\emp.xls -c -U "test" -P
"123"' --将数据库hrm中 表t_emp导出到d:\emp.xls ,即是导出成电子表格文件

sql自带的导入导出不行吗?