I have created a package that Runs a Sql Query and then puts the results into a flat tab delimited txt file.

When I opened the flat file in excel everything was in the right columns but in columns where i had a combination of alpha characters and numerical characters I was getting extra trailing blank spaces in certain records (as shown below). What I did was, added a derived Column step where i would do RTRIM(memberid) which successfully removed the trailing spaces but now the column was still aligned to the left while all the other records were aligned to the right. Has anyone ever come across this scenario and is there anything i can do so that the columns are all aligned to the RIGHT?


1 Answer 1


The columns that are aligned to the right are deemed as numeric fields by Microsoft Excel, anything with a letter in it is deemed an alphanumeric field.

I do not believe there is an export method in SQL Management that would have Excel change the alignment of the cells, any change in formatting would need to be done in Excel post-export.

Alternatively, if you just want the alignment to be consistent, you could import the text with the Text Import Wizard and set all the columns to have 'Text' formatting.

  • Thank you. I guess the most important part was getting rid of the Trailing Blank spaces which I was able to do. I Just have to let the end user know that the alignment of the data does not change the data. Thank you for explaining this to me.
    – Juan Velez
    Apr 1, 2013 at 20:13

Not the answer you're looking for? Browse other questions tagged or ask your own question.