dbTalk Databases Forums  

Export query result set to CSV file.

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss Export query result set to CSV file. in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Mike T.
 
Posts: n/a

Default Export query result set to CSV file. - 09-12-2003 , 01:49 PM






Hello,

Anyone know how to export a SQL result set to CSV with SQL
Server 7?

We have a series of queries which run and produce unique
result sets based on user's criteria. We then want to
export these result sets to a CSV file on the server.

Thank you,

Mike

Reply With Quote
  #2  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: Export query result set to CSV file. - 09-12-2003 , 03:19 PM






Look at BCP
Look at osql with the -q and -o arguments




Allan Mitchell (Microsoft SQL Server MVP)
MCSE,MCDBA
www.SQLDTS.com
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


Reply With Quote
  #3  
Old   
Sue Hoegemeier
 
Posts: n/a

Default Re: Export query result set to CSV file. - 09-12-2003 , 03:28 PM



At a high level, export the results of a sql statement to a
CSV file can be done pretty easily. Drop a SQL connection on
the designer and set the properties. Drop a text file
destination on the designer and set those properties. Then
just add a transform data task between the two, enter your
sql statement, set the destination and transformations and
that's about it.

-Sue

On Fri, 12 Sep 2003 11:49:19 -0700, "Mike T."
<m.tamburro (AT) technologue (DOT) com> wrote:

Quote:
Hello,

Anyone know how to export a SQL result set to CSV with SQL
Server 7?

We have a series of queries which run and produce unique
result sets based on user's criteria. We then want to
export these result sets to a CSV file on the server.

Thank you,

Mike


Reply With Quote
  #4  
Old   
Mike T.
 
Posts: n/a

Default Re: Export query result set to CSV file. - 09-15-2003 , 11:29 AM



Thank you for the suggestions. I did read SQL Books Online
for both osql and bcp, but don't get the impression either
can be automated or called either via ODBC or from a
stored procedure. Is this correct?

If so, we need another solution, if one exists. This is
because our users create queries dynamically with a client
software package. So, we need an automated process to copy
the final results of all the processing into a CSV file.
We don't even know ahead of time what the query looks
like, as it is generated on-the-fly and varies each time,
along with the results.


Quote:
-----Original Message-----
Look at BCP
Look at osql with the -q and -o arguments




Allan Mitchell (Microsoft SQL Server MVP)
MCSE,MCDBA
www.SQLDTS.com
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org

.


Reply With Quote
  #5  
Old   
Mike T.
 
Posts: n/a

Default Re: Export query result set to CSV file. - 09-15-2003 , 11:31 AM



Thank you, but we are looking for an automated process.
Our queries are built on-the-fly, so we don't have a pre-
determined SQL statement. Of course, the results vary, too.

Can the method you recommended be automated under these
conditions?


Quote:
-----Original Message-----
At a high level, export the results of a sql statement to
a
CSV file can be done pretty easily. Drop a SQL connection
on
the designer and set the properties. Drop a text file
destination on the designer and set those properties. Then
just add a transform data task between the two, enter your
sql statement, set the destination and transformations and
that's about it.

-Sue

On Fri, 12 Sep 2003 11:49:19 -0700, "Mike T."
m.tamburro (AT) technologue (DOT) com> wrote:

Hello,

Anyone know how to export a SQL result set to CSV with
SQL
Server 7?

We have a series of queries which run and produce unique
result sets based on user's criteria. We then want to
export these result sets to a CSV file on the server.

Thank you,

Mike

.


Reply With Quote
  #6  
Old   
Sue Hoegemeier
 
Posts: n/a

Default Re: Export query result set to CSV file. - 09-15-2003 , 01:14 PM



I read your response to Allan as well and if you are using
client software for the users to run ad hoc queries, why not
tackle it from that end? Exporting the results from there?
But I'm a little unclear as to how this is
architected...e.g. I don't know if this is off the shelf
software, if it's written in house, if you want to write a
new front end to achieve what you have posted about, etc.
Some of the directions would likely depend upon issues,
architecture of the software package being used.

-Sue

On Mon, 15 Sep 2003 09:31:55 -0700, "Mike T."
<m.tamburro (AT) technologue (DOT) com> wrote:

Quote:
Thank you, but we are looking for an automated process.
Our queries are built on-the-fly, so we don't have a pre-
determined SQL statement. Of course, the results vary, too.

Can the method you recommended be automated under these
conditions?


-----Original Message-----
At a high level, export the results of a sql statement to
a
CSV file can be done pretty easily. Drop a SQL connection
on
the designer and set the properties. Drop a text file
destination on the designer and set those properties. Then
just add a transform data task between the two, enter your
sql statement, set the destination and transformations and
that's about it.

-Sue

On Fri, 12 Sep 2003 11:49:19 -0700, "Mike T."
m.tamburro (AT) technologue (DOT) com> wrote:

Hello,

Anyone know how to export a SQL result set to CSV with
SQL
Server 7?

We have a series of queries which run and produce unique
result sets based on user's criteria. We then want to
export these result sets to a CSV file on the server.

Thank you,

Mike

.



Reply With Quote
  #7  
Old   
Mike T.
 
Posts: n/a

Default Re: Export query result set to CSV file. - 09-17-2003 , 03:56 PM



Thanks for replying again. We want to tackle it from the
server because the query results are sometimes huge and we
don't want to drag them across the internet from our
server to the client. The hope is to convert to csv and
transfer a much smaller file across the wire.

Quote:
-----Original Message-----
I read your response to Allan as well and if you are using
client software for the users to run ad hoc queries, why
not
tackle it from that end? Exporting the results from there?
But I'm a little unclear as to how this is
architected...e.g. I don't know if this is off the shelf
software, if it's written in house, if you want to write a
new front end to achieve what you have posted about, etc.
Some of the directions would likely depend upon issues,
architecture of the software package being used.

-Sue

On Mon, 15 Sep 2003 09:31:55 -0700, "Mike T."
m.tamburro (AT) technologue (DOT) com> wrote:

Thank you, but we are looking for an automated process.
Our queries are built on-the-fly, so we don't have a pre-
determined SQL statement. Of course, the results vary,
too.

Can the method you recommended be automated under these
conditions?


-----Original Message-----
At a high level, export the results of a sql statement
to
a
CSV file can be done pretty easily. Drop a SQL
connection
on
the designer and set the properties. Drop a text file
destination on the designer and set those properties.
Then
just add a transform data task between the two, enter
your
sql statement, set the destination and transformations
and
that's about it.

-Sue

On Fri, 12 Sep 2003 11:49:19 -0700, "Mike T."
m.tamburro (AT) technologue (DOT) com> wrote:

Hello,

Anyone know how to export a SQL result set to CSV with
SQL
Server 7?

We have a series of queries which run and produce
unique
result sets based on user's criteria. We then want to
export these result sets to a CSV file on the server.

Thank you,

Mike

.


.


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.