Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 querying data to a file through sql

Author  Topic 

aravindt77
Posting Yak Master

120 Posts

Posted - 2008-01-10 : 03:46:47
Hi ,

I want to query out some data from a database , which is through an application program and the output to be written in a file in a specified path with sql statement.

Is it possible to write sql query in an application prgram that save it in a text or any other formatted file in a specified folder ??

If possible , Plz do let me know how this could be done !!!

Urgent !!!

Thanks & Regards

Arv

nr
SQLTeam MVY

12543 Posts

Posted - 2008-01-10 : 03:51:28
There are a number of methods
http://www.nigelrivett.net/SQLTsql/WriteTextFile.html
Bcp is usually the easiest.
http://www.simple-talk.com/sql/database-administration/creating-csv-files-using-bcp-and-stored-procedures/


==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

aravindt77
Posting Yak Master

120 Posts

Posted - 2008-01-10 : 03:55:11
Thanks for the Reply...

But BCP is a command prompt utility .. Am i right ??

I want to use the SQL inside the application program..

Plz do the needful..

Thanks

Aravind
Go to Top of Page

nr
SQLTeam MVY

12543 Posts

Posted - 2008-01-10 : 03:58:18
Can't be done. There is nothing in t-sql that will write to the file system (apart from a database file) without loading an application.


==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -