Need to export SQL Query to .XLS ?

  • SQLCMD -S.\dinerware -d BWG -i "C:\DWBACKUP\HouseAccount.sql" -o "C:\DWBACKUP\HouseAccount.xls"

    This 'works' but the formatting is not what I need to copy into quickbooks.

    Why doesn't this command preserve the output I see from the query in SQL? I need this with headers and formatted as a proper Excel sheet.

    Can anyone help?

    Thanks,

    Chris

  • That's not a valid method of outputting to an excel format. If you're doing that way you'd be best to try outputting to comma tab delimited file, then open using excel where it should open in the format you want and then can save as .xls. Below article has some sample syntax

    You're best (and probably easiest) bet is to try using the Import/export wizard and choosing your destination as an excel file.

  • im getting this error can you tell me how to resolve it?

    Executing (Warning)

    Messages

    Warning: Preparation SQL Task 1: Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done. (SQL Server Import and Export Wizard)

    Warning: Preparation SQL Task 1: Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done. (SQL Server Import and Export Wizard)

    - Copying to `tblSFUpload` (Error)

    Messages

    Error 0xc0202009: Data Flow Task 1: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80004005.

    (SQL Server Import and Export Wizard)

    Error 0xc0209029: Data Flow Task 1: SSIS Error Code DTS_E_INDUCEDTRANSFORMFAILUREONERROR. The "input "Destination Input" (615)" failed because error code 0xC020907B occurred, and the error row disposition on "input "Destination Input" (615)" specifies failure on error. An error occurred on the specified object of the specified component. There may be error messages posted before this with more information about the failure.

    (SQL Server Import and Export Wizard)

    Error 0xc0047022: Data Flow Task 1: SSIS Error Code DTS_E_PROCESSINPUTFAILED. The ProcessInput method on component "Destination - tblSFUpload" (604) failed with error code 0xC0209029 while processing input "Destination Input" (615). The identified component returned an error from the ProcessInput method. The error is specific to the component, but the error is fatal and will cause the Data Flow task to stop running. There may be error messages posted before this with more information about the failure.

    (SQL Server Import and Export Wizard)

    Error 0xc02020c4: Data Flow Task 1: The attempt to add a row to the Data Flow task buffer failed with error code 0xC0047020.

    (SQL Server Import and Export Wizard)

    Error 0xc0047038: Data Flow Task 1: SSIS Error Code DTS_E_PRIMEOUTPUTFAILED. The PrimeOutput method on component "Source - tblSFUpload" (1) returned error code 0xC02020C4. The component returned a failure code when the pipeline engine called PrimeOutput(). The meaning of the failure code is defined by the component, but the error is fatal and the pipeline stopped executing. There may be error messages posted before this with more information about the failure.

    (SQL Server Import and Export Wizard)

  • Could well be a datatype issue. Were there any warnings on the 'review datatype mapping' page?

  • Ok, so my thread has been hijacked?

    Grrr

  • pruebahola Tio, prueba con esto

    bcp "SELECT id, Nombre, Apellido, Direccion, Distrito FROM practiceDB.DBO.EMPLEADO" queryout C: \ PruebaXLS \ empleado.xls -T -c

    • This reply was modified 5 years, 3 months ago by  ING_CHOY.

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply