Re: Viewing xml returned from stored procedures
- From: "McGeeky" <anon@xxxxxxxx>
- Date: Fri, 29 Apr 2005 10:41:17 +0100
Is there a way to stream the data directly to a file rather than caching in
the XML document first? The data volumes could be quite large.
--
McGeeky
http://mcgeeky.blogspot.com
"Graeme Malcolm" <graemem_cm@xxxxxxxxxxx> wrote in message
news:upvZCFBTFHA.2124@xxxxxxxxxxxxxxxxxxxxxxx
> Here's a really quick and dirty VB script that retrieves the data from the
> sproc, saves it as a file, and displays it in IE. I'm sure there are more
> elegant solutions out there, but this might get you started.
>
> Just enter the stored procedure name as <db_name>.<owner>.<sproc_name>
> (e.g.
> northwind.dbo.getproductsxml)
>
> Const DBGUID_SQL = "{C8B522D7-5CF3-11CE-ADE5-00AA0044773D}"
> Const adExecuteStream = 1024
> Const adReadAll = -1
> Const adCmdStoredProc = 4
>
> GetData
> DisplayResults
>
> Function GetData()
> Dim conn
> Set conn = CreateObject("ADODB.Connection")
> conn.Provider = "SQLXMLOLEDB.3.0"
> conn.ConnectionString = "DATA PROVIDER=SQLOLEDB;" & _
> "SERVER=(local);DATABASE=northwind;INTEGRATED SECURITY=sspi;"
> conn.Open
> Dim cmd
> Set cmd = CreateObject("ADODB.Command")
> Set cmd.ActiveConnection = conn
> 'Set the dialect
> cmd.Dialect = DBGUID_SQL
> Dim xmlDoc
> Set xmlDoc= CreateObject("MSXML.DOMDocument")
>
> cmd.Properties("xml root") = "QueryResults"
> cmd.Properties("Output Stream") = xmlDoc
> 'Specify the command
> cmd.CommandText = InputBox ("Enter Stored procedure Name")
> cmd.CommandType = adCmdStoredProc
> 'Execute the command returning a stream
> cmd.Execute, , adExecuteStream
> xmlDoc.Save "results.xml"
> End Function
>
> Function GetAppPath()
> Dim strScriptPath
> Dim strScriptName
>
> strScriptPath=WScript.ScriptFullName
> strScriptName=WScript.ScriptName
> GetAppPath = Left(strScriptPath, Len(strScriptPath)-Len(strScriptName))
> End Function
>
> Function DisplayResults()
> Dim wshshell
> set Wshshell= WScript.createobject("wscript.shell")
> Wshshell.run "iexplore.exe File://" & GetAppPath & "results.xml"
> End Function
>
> --
> ----
> Graeme Malcolm
> Principal Technologist
> Content Master Ltd.
> www.contentmaster.com
>
>
> "McGeeky" <anon@xxxxxxxx> wrote in message
> news:%23%23KNEw9SFHA.2840@xxxxxxxxxxxxxxxxxxxxxxx
> Does anyone know of a utility that makes the viewing of xml data returned
> by
> stored procedures easier? When using query analyzer the xml data is
> returned
> as a single row. Its very hard to see the data!
>
> What would be nice is a command line tool that can run a query and format
> the xml that is returned. Or better still, a gui equivalent.
>
> Ideas?
>
> --
> McGeeky
> http://mcgeeky.blogspot.com
>
>
>
>
.
- Follow-Ups:
- Re: Viewing xml returned from stored procedures
- From: Graeme Malcolm
- Re: Viewing xml returned from stored procedures
- References:
- Viewing xml returned from stored procedures
- From: McGeeky
- Re: Viewing xml returned from stored procedures
- From: Graeme Malcolm
- Viewing xml returned from stored procedures
- Prev by Date: RE: Viewing xml returned from stored procedures
- Next by Date: Re: Viewing xml returned from stored procedures
- Previous by thread: Re: Viewing xml returned from stored procedures
- Next by thread: Re: Viewing xml returned from stored procedures
- Index(es):
Relevant Pages
|