Unconfigured Ad Widget

Collapse

Anúncio

Collapse
No announcement yet.

Exportar resultado do SQL para Excel

Collapse
X
 
  • Filter
  • Tempo
  • Show
Clear All
new posts

  • Font Size
    #1

    Duvida Exportar resultado do SQL para Excel

    Boa Tarde Pessoal,
    Eu pesquisei algumas possibilidades sobre export do sql para excel, consegui montar uma solução pelo wizard porém na minha maquina funciona e no servidor gera o seguinte erro:

    - Executing (Error)
    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)

    Error 0xc002f210: Preparation SQL Task 1: Executing the query "CREATE TABLE `SERVICO` (
    `SERVICO` Byte,
    `DESCRI..." failed with the following error: "Cannot modify the design of table 'SERVICO'. It is in a read-only database.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.
    (SQL Server Import and Export Wizard)
    ---------------------------------------------------------------------------------

    Então tentei pelo Openrowset, utilizando o seguinte código:

    sp_configure 'show advanced options', 1;
    GO
    RECONFIGURE;
    GO

    sp_configure 'Ad Hoc Distributed Queries', 1;
    GO
    RECONFIGURE;
    GO

    USE EPG_TECNOLOGIA

    CREATE TABLE PESSOA
    (
    COD INT,
    NOME VARCHAR (50)
    )

    INSERT PESSOA VALUES(11,'LUA')
    INSERT PESSOA VALUES(21,'SOL')
    INSERT PESSOA VALUES(31,'UNIVERSO')

    SELECT * FROM PESSOA

    SELECT * FROM OPENROWSET
    ('Microsoft.ACE.OLEDB.12.0',
    'Excel 12.0 Xml;HDR=YES; Database=C:\Data\TGB01.xlsx',
    'select cod, nome from [PLAN1$]')

    e também é gerado o erro:

    Msg 7354, Level 16, State 1, Line 16
    The OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "(null)" supplied invalid metadata for column "cod". The data type is not supported.


    alguém consegue me ajudar a resolver pois desconheço esse erro e não encontrei nada relacionado.
    Similar Threads
X
Working...
X