Home Forums SQL Server 7,2000 T-SQL export all table to excel with header using bcp RE: export all table to excel with header using bcp

  • This looks like it might be really useful. Has anyone managed to get it to work? All it does for me is generate a list of errors when I execute the stored procedure.

    The errors include: Error = [Microsoft][SQL Native Client]Unable to resolve column level collations

    and: BCP copy out failed

    I'm assuming the argument @sql is a query string, and @fullFileName is the output file path and name.

    For @sql I tried

    ' select col1, col2, col3 from source_table' Then I tried leaving off 'select' -- both failed.

    I tried just the table name, and tried it with 'dbo.' -- nothing works.

    I changed the syntax of the BCP to what works for me in other procedures, but can't get this to do anything, but that may be because the rest of the procedure has already failed.