Unknown VBScript runtime error when setting excel cell value with the long text (NVARCHAR) RRS feed

  • Question

  • Hello All,

    I'm trying to import a SQL query result into an excel. 

    Get the query result into a ADODB resultset variable and trying to set into the excel cell as Cells(x,y).Value=rs("LongText").

    I'm getting the runtime error as "Microsoft VBScript runtime error: unknown runtime error"

    The sql column "LongText" is a NVARCHAR(MAX) field and some of the records have very lengthy value (max. 30100)

    On investigation, I feel like I get this error only if the column value length is greater than 8224 (not sure about the exact length)

    Can someone please help me to fix this issue? 

    Note: I'm calling this .vbs file from a batch file


    Friday, May 15, 2020 9:55 PM