Results 1 to 8 of 8
  1. #1
    Join Date
    May 2004
    Location
    India \n now Dubai
    Posts
    6

    Unanswered: Redirect the Queries Output

    Hello friends

    i m using Sqlserver 2000 and i wish to know that ,
    Can i redirect the output of the query into a text/xls/html file !
    If possible then please help me !!!!!

    Thanks

  2. #2
    Join Date
    Aug 2004
    Posts
    11
    I don't think that you can do it directly, but create a temporary table [ select into tablename from ] and then use the export wizard

    Alternately make your query into a view and export that

    Andy

  3. #3
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    Use bcp with QUERYOUT
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  4. #4
    Join Date
    May 2004
    Location
    Columbus, OH
    Posts
    59
    Quote Originally Posted by manishkaushik
    Hello friends

    i m using Sqlserver 2000 and i wish to know that ,
    Can i redirect the output of the query into a text/xls/html file !
    If possible then please help me !!!!!

    Thanks
    If you are using Querry Analyzer, you can select all of the output rows, copy them into the clipboard, and then past it into whatever you want(Excel, Word, etc.)

    But, I'm not sure that is what you were looking for, but just in case it was...

    Have Fun....

  5. #5
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    Use DTS. Isn't that what it is for?
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

  6. #6
    Join Date
    Jan 2003
    Location
    Massachusetts
    Posts
    5,799
    Provided Answers: 11
    You can go from a query right to a text file in Query Analyzer. Look at Tools->options->results tab.

  7. #7
    Join Date
    Feb 2004
    Location
    Burbank & Santa Cruz de la Sierra
    Posts
    3,716
    Just to get my .02 worth in, we do this quite regularly using the BCP to QUERYOUT solution. Works like a charm, even if you wanna call the bat file from a SQL Server scheduled job and then have the bat file do the BCP job which calls a SQL Server proc. *whew* Now I'm dizzy.
    aka "Paul"
    Non est ei similis.

    I just read "100 Things To Do Before You Die". I was surprised that "Yell for help!!" wasn't one of them

  8. #8
    Join Date
    Feb 2004
    Location
    San Antonio, TX
    Posts
    565
    you can also use the osql to do this
    osql /E /i c:\ScriptWithQueryResults.sql /o c:\OutputQueryResults.txt

Posting Permissions

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