两张sql表导入到一个excel表中的错误
EXEC master..xp_cmdshell 'bcp "SELECT job_id,job_desc FROM jobs..authors ORDER BY job_id " queryout c:\authors.xls -N -GENGCHAO -sa -1324678910 '
这段代码,哪里错了,谢谢大家,在线等!!!
------解决方案----------------------假设authors表与jobs关联字段为id,要导出字段分别为col1,col2
exec master..xp_cmdshell 'bcp "SELECT a.col1,b.col2 FROM 数据库名..authors a, 数据库名..jobs b where a.id=b.id ORDER BY col1 " queryout c:\authors.xls -N -S "GENGCHAO " -U "sa " -P "1324678910 " '