SQL Server 2008 Express R2 Format query output to textfile

I have a large table (~ 6GB) which is bigger than my computers RAM that I'm trying to output from a SQL Server data base to a text file in a specific format to be used as an input for another program.

The data base looks looks something like this:

bought    month     day
   0        11       01
   0        10       07
   1        01       06
   1        04       03
   0        08       03
   0        07       03
   0        02       03
   0        11       05
   1        09       02
  ...       ...     ...

I need the output file to be formatted like this:

0 | month:11 day:01
0 | month:10 day:07
1 | month:01 day:06
1 | month:04 day:03
0 | month:08 day:03
0 | month:07 day:03
0 | month:02 day:03
0 | month:11 day:05
1 | month:09 day:02
...

Any suggestions for how to do this?

Answers


If you're running SQL Server management studio, you can output to a file.

Go to Tools-> Options -> Query Results and you should be able to choose "Results to file" - specify the directory underneath, and run your query.


Need Your Help

Recursive entry to executePendingTransactions

android android-listview android-fragments forceclose

I have a MainDrawer to Fragment activity which has a layout for a nav drawer my and my main content where I can load new fragments into. One fragment I load in is calle StatisticsTab Fragment. This

angular-google-maps labels overlapse icons

javascript angularjs google-maps google-maps-api-3 ionic-framework

so i've created an angular aplication with the angular-google-maps library which include the markerswithlabels directory and the labels overlapse the icons so u can see the other label on top of an...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.