The problem comes from the Yu Tianxian bi community, which is interesting to see because I myself think there is more experience in SSIS dealing with various types of files (almost all ETL is related to files for a year), but this question has not been specifically considered before. Studied a bit, found a solution, hurriedly recorded.
A brief description of this problem, if our SOURCE is directly from the table query, and then output to the file, the order of the columns in the query statement is the order of the output file columns (comma-delimited file). But if you use variable query statements, then the order of output and query columns will be inconsistent! If our file format has been defined in advance, then this will be very difficult to adjust. Unless you manually delete all the columns in the File Manager, and then re-establish them, it can be time-consuming and exhausting, and very error-prone.
Take a look at the problem first, and then look at the more simple solution.
Test the Data source query statements and results-
If you are querying directly, the order of the output columns of the file does not have any problems or effects, and the following are my query statements, as in SQL Server.