SQL: Excel file has bigger size using OPENQUERY to update it

  • Maybe the solution can be so easy but I can't find it so I write here for some help.

    We have this sql function:

    CREATE FUNCTION [dbo].[updateExcel]

    (

    -- Add the parameters for the function here

    @cell VARCHAR(4),

    @description VARCHAR(200)

    )

    RETURNS BIT

    AS

    BEGIN

    DECLARE @sql NVARCHAR(1000)

    SET @sql = 'UPDATE openquery(LinkedServer2ExcelFile, ''SELECT * FROM [Sheet1$'+@cell+':'+@cell+']'') set F1 = '''+@description+''''

    --PRINT @sql

    EXEC sp_executesql @sql

    RETURN 0

    END

    ----

    that we use to update some excel file

    EXEC @Result = updateExcel 'somecell', 'somevalue'

    The problem is that after this update the excel has a bigger size. But when we open it and save it again, the file's size get normal again

    I hope to find here some answers ...

    Thanx !!!

Viewing 0 posts

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