Title: How to populate 10 different query results with different columns and number of columns to a text file in MSSQL
Tags: sql-server-2008;reporting-services;ssis
Question: I am doing a project to generate data extracts on a daily basis. I have ten different queries with different columns and also the number of columns are also different. the database is MSSQL server 2008 R2 and I tried SSIS packet to accomplish the result.I used the components datasource, then a sort and the result of the sort to merge and then to text file. But I am getting error when combining the result saying the columns are different or something. Can anyone suggest a solution or is there any other way to accomplish this.
thanks,
Sivajith


Here is another answer: Can you please provide error message? The merge component can merge data flows with various amount of columns, by selecting  for the input columns.
Comment for this answer: This should not be an answer. It should be a comment to the original question.

Here is another answer: Here are the following reference that may help you a bit more:
SQL Server : export query as a .txt file
You will have to make sure you have a proper connection to the SQL server and then run this as a powershell or a .bat file. This can be scheduled to run daily as well.
Comment for this answer: I am sorry if the question is confusing . First of all the I cannot set empty columns for each script to make same number of columns because there is specific column numbers for each result set. Why I need a single file - the answer is simple the client requirement is like that and they won't change it.
Comment for this answer: Have you taken a look at this: http://stackoverflow.com/questions/6354130/is-there-a-select-into-outfile-equivalent-in-sql-server-management-studio
Comment for this answer: This should not be an answer. It should be a comment to the original question.

Here is another answer: First create a template .csv file which contain all the columns from the queries (i.e. if you have the columns A B C in the first query, B, E, F in the 2nd , B , X, Y in the third and so on, make sure your template file will have A B C E F X Y)
Make 10 tasks (one for each query). As a source use sql from command and write your query. As a destination, use the template file created above. Make sure you uncheck "Overwrite data".
Use the same destination for all the queries.
This should do the trick. I am not sure that I completely understood your question since it's a little big vague.

{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 3, 'CommentCount': 0, 'ContentLicense': 'CC BY-SA 3.0', 'CreationDate': '2015:00:07/22/15', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<sql-server-2008><reporting-services><ssis>', 'Title': 'How to populate 10 different query results with different columns and number of columns to a text file in MSSQL', 'ViewCount': 66, 'id': 31570384, 'user_AboutMe': '<p>searching for new developments and want to share new technologies.</p>\n', 'user_AccountId': 894422.0, 'user_DisplayName': 'Sivajith', 'user_Reputation': 1161.0, 'user_Views': 254.0, 'user_id': 932014.0}}