在sql中快速导入、导出Excel

--导出不能回行
EXEC master..xp_cmdshell 'bcp "exec dbo.Redev_pr_GetDepartment_LingShouZhan_ZuoYe" queryout "C:\LingShouZhan.xls"  -Sfileserver -Usa -P123456  -c'


--导入不能回行

SELECT *
FROM OpenDataSource( 'Microsoft.Jet.OLEDB.4.0','Data Source="E:\Documents and Settings\Administrator\桌面\授予不匹配情况.xls";User ID=Admin;Password=;Extended Properties="Excel 8.0;HDR=Yes;IMEX=1"')...[sheet1$]
导出的Excel文件的格式为文本格式。
原文地址:https://www.cnblogs.com/Bruce_H21/p/784154.html