Excel SSIS query returns null columns in Excel but not in Management studio

前端 未结 2 2067
离开以前
离开以前 2021-01-24 05:31

I did my best to look around the web but this problem eludes me. I have a stored procedure in SSIS that works fine. It does a bunch of stuff eventually returning some numbers an

2条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-24 06:06

    The solution to this issue came down to data types. If you know that your destination Excel, as I did, then you have to use a data type that Excel can convert. I had been using nvarchar(max) which wasn't being brought over to Excel, When I changed the fields to text and char, I was good. I found this answer from Microsoft once I knew what to look for: Microsoft Excel Data Types. There was also a page on limitations: Data Type Limitations. The other piece was that I was using a stored procedure rather than pure SQL although there was also a problem with selecting directly from the table. I tried to load a table rather than relying on the stored procedure with similiar failures. No errors were returned in any of this, it was just no data. Through my testing, here are the text/character type conversions and their success:

    text - works
    ntext - works
    char - works
    nchar - works
    varchar - failed
    nvarchar - failed

提交回复
热议问题