Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2003
    Posts
    223

    Unanswered: How to export a temp table to a text file?

    Hello everyone:

    I create a temperal table to load data in a stored procedure. At last I want to export this temp table to a text file.

    Any suggestion will be great appreciated.

    ZYT

  2. #2
    Join Date
    Jun 2003
    Posts
    269
    see this example,
    Code:
    use pubs
    go
    create proc tt
    as 
    select au_id,au_lname,au_fname,contract into #tt1 from authors
    select * from #tt1
    go
     
    EXEC master..xp_cmdshell 'osql -S. -E -q " set nocount on exec pubs..tt set nocount off" -n -w8000 -o "c:\authors.csv" -h -s ","'
    I love cursor,though I never use it.Cos' I dont want to misuse it.
    ----------------------------------------------

    ----cheers
    ----http://mallier.blogspot.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •