Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query Analyzer Output

Status
Not open for further replies.

tapks

IS-IT--Management
Sep 6, 2001
72
IN
Hi!

I am getting an XML output in Query Analyzer which is more that 8000 character, hence unable to see the whole output.

CAn I save the output to a text file so that I can see the output ot is there any way I can see the total output in query analyzer.

Can anybody help me..

Thanks in advance.

Tap_ks
 
In short.. NO

you might want to try using the OSQL tool and specify an output file however. OSQL has no limits like OSQLW (EM) as far as I am aware, so should enable you to get all your databack.

If that fails however, have you thought about writing a short vbs script?

for instance change the Command="select * from dbo.sysobjects" to your query and run the following script. It should place a text file in the root of C:

How to use the script
1. Cut all code out of the
Code:
 block and insert it into an ascii text file. 
2.Save the file as c:\test.vbs (or some other name)
3.Execute it from the Run Command passing in 2 arguments
  1. -s  YourServerName
  2. -d  YourDatabase

e.g. c:\test.vbs -sMySQLServer -dNorthwind

As far as I can think there should be no limitation of return here at all. (you can post back if there is:)



[code]

dim c,r,server,database,table, cnstring, command

for each arg in Wscript.arguments
	select case lcase(left(arg,2))
		case "-s"
			server= right(arg,len(arg)-2)
		case "-d"
			database=right(arg,len(arg)-2)
	end select
next


command = [red]"select * from dbo.sysobjects" [/red]
cnstring = "Provider=sqloledb;integrated security=sspi;database=" & database & ";server=" & server

set c = createobject("adodb.connection")
set r = createobject("adodb.recordset")
c.open cnstring
r.open command,c

Dim fso, f1
   Set fso = CreateObject("Scripting.FileSystemObject")
   Set tf = fso.CreateTextFile("c:\testfile.txt", True)
	do while not r.eof
	   tf.WriteLine(r(0) & ", " & r(1) & ", " & r(2))
	   r.movenext
	loop
tf.Close
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top