views:

263

answers:

2

Hi

I want to use SQL SERVER 2005 commands to generate tab-delimited file. I want to create a complex query and give it to something (say a function) to export data with columns names into a tab-delimited file.

If u don't know something doing this, suggest an idea that reduces the headache of doing it from scratch using C#.

AHH, I am not willing to learn SSRS as I'm supposed to finish this in one day, but if this is the only way, tell me.

Thank u for ur time

+2  A: 

try out SQL Server bcp.exe tool

DNNX
I did not try that programaticaly but from msdn it should work.
Costa
+1  A: 

It is unclear from your question whether you just need to achieve the tab-delimited output, or whether you need to do it programmatically. If this is just for a one-off task, then I suggest you use SQL Server Management Studio.

Go to Tools -> Options -> Query Results -> SQL Server -> Results to Text and set the output format to "Tab delimited". Ok that change, then run your query using SSMS, making sure you have "Results to Text" enabled (Query -> Results To -> Results to Text). You will need to use a new query window as only new query windows pick up the settings changes.

The output of your query should now show in the results window with tab delimiters.

Obviously, this is not much help if you need to achieve this programmatically.

adrianbanks