April 18, 2011 at 7:52 am
Hi All,
I am SQL newbie so please forgive the ignorance.
What I am trying to achieve is to find the best way to execute multiple ad-hoc queries across a number of databases passing the results to a CSV file.
I support an application that utilises SQL server as the backend creating a number of various databases. Currently when visiting customer sites I execute the queries manually. What I would like to be able to do is create a single generic script that would run these queries and pass the results to a csv file.
Because my customers have various restrictions and security policies in place I cannot make use of custom SP's or Db's.
Any assistance would be much appreciated.
Thanks
April 18, 2011 at 8:00 am
it is much easier to write a file within your application than it is to do it on the SQL Server.
You run into a lot of permissions issues where the file gets created to disk on the server, but the location of the file is not exposed to the end user, so they cannot get to it.
Why can you not have your application run the query, then either stream the formatted results of the dataset to the user(assuming a web application) or simply write to a file if it is a client/desktop application?
Lowell
April 19, 2011 at 1:46 am
Thanks for your reply Lowell,
Unfortunately i am just a lowly support guy with no code access for the or any influence on what should be included 🙂
However, I get your point that it will be easier to do it outside of SQL. I will look into doing that.
Thanks Again.
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply