BCP导出数据到EXCEL

SET @FilePath='D:\TEST.xls'
SET @sql='bcp "SELECT * FROM XXX.dbo.XXX WITH(NOLOCK) WHERE XXX=''XXX'' AND XXX = '+@XXX+'" QueryOut '+@FilePath+' -c -T '
EXEC master..xp_cmdshell @SQL 

 

posted @ 2017-05-31 10:49  芈璐  阅读(1102)  评论(0编辑  收藏  举报