Drop Table
Support Forum for database administrators and web based access to important newsgroups related to databasesI 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?
Post Follow-up to this messageThis 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?
Post Follow-up to this messageYes, 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 > > >
Post Follow-up to this messageWhy 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?
Post Follow-up to this messageIt 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
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread