1. SQL returns "*" when casting/converting an integer to data type varchar, and the data length is too short. Two two lines of code will show what I mean:
SELECT CAST(123 AS VARCHAR(3)) -- Returns 123
SELECT CAST(123 AS VARCHAR(2)) -- Returns *This caused be issues because I (unfortunately) have to create a massive dynamic SQL statement to do some ridiculous data transformation from a flat file data source to an XLS file to importing into another database. Yes, I understand the best way to do it would be to insert directly into the necessary tables, however the vendor doesn't want us doing that.
2. You need to have the same number of columns numbered in your Excel spreadsheet destination as you are selecting from the database.
As I mentioned above, I need to output data to an XLS file, and each column that I am placing data in has to be numbered. So if I select 61 columns of data from SQL, there has to be columns numbered 1 to 61 on the first row of the spreadsheet. 60 or 62 causes errors.