Drop Table

Support Forum for database administrators and web based access to important newsgroups related to databases
Register on Database Support Forum Edit your profileCalendarFind other Database Support forum membersFrequently Asked QuestionsSearch this forum -> 
For Database admins: Free Database-related Magazines Now Free shipping to Texas


Post New Thread










Thread
Author

CSV
I am attempting to exports the results of a stored Procedure into a CSV. The
table is a temp tabel named #FinalPrivate. I need to allow a user to downloa
d
the file from a .NET Web Application. Is there someone that can point me in 
a
direction?

Report this thread to moderator Post Follow-up to this message
Old Post
sorourke1@hotmail.com
03-01-06 01:23 AM


Re: CSV
This sounds like a one-time, or not frequent need.  If the results are
<65000 records, it is probaby easiest to highlight the results in query
analyzer (hit CTRL - A on any cell to select all cells), hit CTRL-C to copy
to the clipboard, and then paste those values into Excel.    Then, in Excel,
choose to "save as" type = comma delimited / CSV.

I do this often and it's easier than your alternatives.   If you need an
automated way that works by itself every 24 hours, then that's a different
story.

"sorourke1@hotmail.com" < sorourke1hotmailcom@
discussions.microsoft.com>
wrote in message news:7C1D66D1-7038-4084-B139- 68D3C7DBB18B@microso
ft.com...
> I am attempting to exports the results of a stored Procedure into a CSV.
The
> table is a temp tabel named #FinalPrivate. I need to allow a user to
 download
> the file from a .NET Web Application. Is there someone that can point me
in a
> direction?



Report this thread to moderator Post Follow-up to this message
Old Post
HK
03-01-06 01:23 AM


Re: CSV
Yes, this is something that needs to be done ~5 times a week by customers on
demand. I need to complete this task programable. Any other thoughts?

"HK" wrote:

> This sounds like a one-time, or not frequent need.  If the results are
> <65000 records, it is probaby easiest to highlight the results in query
> analyzer (hit CTRL - A on any cell to select all cells), hit CTRL-C to cop
y
> to the clipboard, and then paste those values into Excel.    Then, in Exce
l,
> choose to "save as" type = comma delimited / CSV.
>
> I do this often and it's easier than your alternatives.   If you need an
> automated way that works by itself every 24 hours, then that's a different
> story.
>
> "sorourke1@hotmail.com" < sorourke1hotmailcom@
discussions.microsoft.com>
> wrote in message news:7C1D66D1-7038-4084-B139- 68D3C7DBB18B@microso
ft.com..
. 
> The 
> download 
> in a 
>
>
>

Report this thread to moderator Post Follow-up to this message
Old Post
sorourke1@hotmail.com
03-01-06 01:23 AM


Re: CSV
Why not simply creating a DTS (or SSIS if you're on 2005) package that will
create that CSV file?  Then it is a one click execute process.


"sorourke1@hotmail.com" < sorourke1hotmailcom@
discussions.microsoft.com> a
écrit dans le message de news:
7C1D66D1-7038-4084-B139- 68D3C7DBB18B@microso
ft.com...
>I am attempting to exports the results of a stored Procedure into a CSV.
>The
> table is a temp tabel named #FinalPrivate. I need to allow a user to
> download
> the file from a .NET Web Application. Is there someone that can point me
> in a
> direction?



Report this thread to moderator Post Follow-up to this message
Old Post
Christian Hamel
03-01-06 01:23 AM


Re: CSV
It seems this is an ASP.NET issue, and not a TSQL issue.   You simply take
the results of the stored procedure and output as comma delimited in your
.NET code.  Here is a very quick example I just pulled from google; it is
not be the best for your needs.   The trick for letting the user vjew the
file is the line that outputs the "contenttype" to the browser.

http://dotnet.org.za/keithrull/arch...7/14/39202.aspx

That example is more meant for Excel output but I share it because it goes
into detail about things.

However, I prefer to use a method with ContentType="text/csv", which lets
the user download the file immediately as a CSV file.  Look for an example
with that.  To quote Jim Buyens in a google groups thread, he writes:

If you're only sending data, the easiest approach is to execute this code:

Response.ContentType = "text/csv"
Response.AddHeader "content-disposition",_
"attachment; filename=yourfile.csv"

then send the visitor a comma-separated-values file via Response.Write, then
call Response.End to make sure that no HTML or other output follows the
data.






"sorourke1@hotmail.com" < sorourke1hotmailcom@
discussions.microsoft.com>
wrote in message news:D9471EF6-7601-47A6-A723- 5B1045B150F6@microso
ft.com...
> Yes, this is something that needs to be done ~5 times a week by customers
on
> demand. I need to complete this task programable. Any other thoughts?
>
> "HK" wrote:
> 
copy 
 Excel,[color=darkred
] 
 different[color=dark
red] 
news:7C1D66D1-7038-4084-B139- 68D3C7DBB18B@microso
ft.com... 
CSV. 
me 



Report this thread to moderator Post Follow-up to this message
Old Post
HK
03-01-06 01:23 AM


Sponsored Links





Last Thread Next Thread
Post New Thread

MS SQL Server archive

Show a Printable Version Email This Page to Someone! Receive updates to this thread
Microsoft SQL Server
Access database support
PostgreSQL Replication
SQL Server ODBC
FoxPro Support
PostgreSQL pgAdmin
SQL Server Clustering
MySQL ODBC
Web Applications with dBASE
SQL Server CE
MySQL++
Sybase Database Support
MS SQL Full Text Search
PostgreSQL Administration
SQL Anywhere support
DB2 UDB Database
Paradox Database Support
Filemaker Database
Berkley DB
SQL 2000/2000i database
ASE Database
Forum Jump:
All times are GMT. The time now is 08:33 AM.

 
Mobile devices forum | Database support forum archive




Copyrights DropTable.com Database Support Forum 2004 - 2006