将数据库中的图片导出到一个XML文件中去, 用的语句是:exec master..xp_cmdshell 'bcp "Select photo from salesman  For xml raw" queryout D:\MyDatabase\tempfile4.xml -c '但是报错说:SQLState = S0002, NativeError = 208
Error = [Microsoft][ODBC SQL Server Driver][SQL Server]对象名 'salesman' 无效。
SQLState = 37000, NativeError = 8180
Error = [Microsoft][ODBC SQL Server Driver][SQL Server]未能准备语句。点解?

解决方案 »

  1.   

    Select photo from salesman  For xml raw
    这样子执行结果?另外
    D:\MyDatabase\tempfile4.xml -c 后面没拉?
    服务器,用户名,密码呢?
      

  2.   

    TO小虾米, 
    Select photo from salesman  For xml raw
    这样子执行结果?--------这里执行没有问题,在查询分析器里生成了XML格式的信息服务器,用户名,密码呢?------用上了也都一样.郁闷
      

  3.   

    而且导出文本到XML中是可以的, 只有导出二进制图片不行.
    exec master..xp_cmdshell 'bcp "Select photo from salesman where sname=''huang'' For xml raw,xmldata,binary base64 "
     queryout D:\MyDatabase\tempfile4.xml -c' --导出图片到XML文件
      

  4.   

    exec master..xp_cmdshell 'bcp "Select photo from dbname.dbo.salesman  For xml raw" queryout D:\MyDatabase\tempfile4.xml -T -c '
    如果不是采用信任连接,将-T改为-U username -P pwd,记得要指定dbname和owner这两部分