|
Home > Archive > MS SQL Server > February 2006 > CSV
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
| sorourke1@hotmail.com 2006-02-28, 8:23 pm |
| 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?
| |
|
| 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?
| |
| sorourke1@hotmail.com 2006-02-28, 8:23 pm |
| 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 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...
> The
> download
> in a
>
>
>
| |
| Christian Hamel 2006-02-28, 8:23 pm |
| 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?
| |
|
| 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[color=darkred]
> demand. I need to complete this task programable. Any other thoughts?
>
> "HK" wrote:
>
copy[color=darkred]
Excel,[color=darkred
]
different[color=dark
red]
news:7C1D66D1-7038-4084-B139- 68D3C7DBB18B@microso
ft.com...[color=darkred]
CSV.[color=darkred]
me[color=darkred]
|
|
|
|
|