option explicit ' Script Name: SQL Search ' Author: Horst Kargl ' Purpose: Example ' Date: 19.6.2012 ' sub main 'Open and clean output Repository.EnsureOutputVisible("Script") Repository.ClearOutput("Script") ' Create a DOM object to represent the search tree dim xmlDOM set xmlDOM = CreateObject( "MSXML2.DOMDocument.4.0" ) xmlDOM.validateOnParse = false xmlDOM.async = false 'The SQL query dim sql sql = "SELECT ea_guid FROM t_object" 'query the result from the Repository dim xmlResultString xmlResultString = Repository.SQLQuery(sql) msgbox "The XML result string: " &xmlResultString 'load the xml result string into the DOM tree if xmlDom.loadXml(xmlResultString) then msgbox "Results are loaded" end if 'get entries from the result using XPath dim node set node = xmlDOM.selectSingleNode( "//Data//Row//ea_guid" ) 'get the first ea_guid entry msgbox "First entry: " &node.nodeName & "= " & node.Text Dim nodeList set nodeList = xmlDOM.selectNodes( "//Data//Row//ea_guid" ) 'get all ea_guid entries for each node in nodeList Session.Output( node.nodeName & "= " & node.Text ) 'write all ea_guids to the output window next end sub main