Casting/Converting XMLType to XMLDocument?

Hi all,
the xml-documents i retreive from the database have the format of oracle.xdb.XMLType.
In my program i use the oracle.xml.differ.XMLDiff class, which needs the xml-document in the format oracle.xml.parser.v2.XMLDocument.
What is the easiest way to cast/convert an XMLType into an XMLDocument ?
thanks, Bart

According to the 9i r2 documentation, the code shown below should work (see http://download-west.oracle.com/docs/cd/B10501_01/appdev.920/a96620/xdb09jav.htm#1656):
What is the alternative with a 10g r1 database?
Example 9-1 XMLType Java: Using JDBC to Query an XMLType Table
The following is an example that illustrates using JDBC to query an XMLType table:
import oracle.xdb.XMLType;
   OraclePreparedStatement stmt = (OraclePreparedStatement)
conn.prepareStatement("select e.poDoc from po_xml_tab e");
       ResultSet rset = stmt.executeQuery();
       OracleResultSet orset = (OracleResultSet) rset;
while(orset.next())
       // get the XMLType
       XMLType poxml = XMLType.createXML(orset.getOPAQUE(1));
       // get the XMLDocument as a string...
Document podoc = (Document)poxml.getDOM();
        }

Similar Messages

  • It is possible to convert String to XMLDocument?

    I use XML SQL Utility to generate an XML document from the results of a query. I want to apply XSLT on this xml document.
    The problem is that XSU generates the document in String format. Or I use XSLProcessor.processXSL, and this method needs to parameters stylesheet and XMLDocument.
    So, my question is :It is possible to convert String to XMLDocument?
    Thanks.

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Steven Muench ([email protected]):
    Use getXMLDOM() instead of getXMLString() on the OracleXMLQuery object. This returns you a DOM representation instead of a string, avoiding parsing.<HR></BLOCKQUOTE>
    Hi
    I'm reading about how " generate an XML document from the results of a query" i exactly want to do this but i need to create the XML file not only generate it. How I "create" the XML file?. Because, I need to manipulate later my XML file.
    Thanks for any help.
    null

  • Convert XMLTYPE to VARCHAR2 or CLOB?

    Does anyone know how to convert an XMLTYPE variable to VARCHAR2 or CLOB? I am using the XMLELEMENT function to select XML into an XMLTYPE variable (VARCHAR2 and CLOB will not accept xml from this function). But I would like to convert the xml in the XMLTYPE variable to VARCHAR2 or CLOB. Can anyone please tell me how to do this? The reason is that I would like to call this procedure from MS ADO.
    Anthony Sneed
    email: [email protected]

    Hi,
    But I would like to convert the xml in the XMLTYPE variable to VARCHAR2 or CLOB.You can select XMLType data using PL/SQL or Java. You can also use the getClobVal(), getStringVal(), or getNumberVal() functions to retrieve XML as a CLOB, VARCHAR, or NUMBER, respectively.
    Example 4-18 Selecting XMLType Columns using getClobVal()
    This example shows how to select an XMLType column using SQL*Plus:
    SET long 2000
    SELECT e.poDoc.getClobval() AS poXML
    FROM po_xml_tab e;
    POXML
    <?xml version="1.0"?>
    <PO pono="2">
    <PNAME>Po_2</PNAME>
    <CUSTNAME>Nance</CUSTNAME>
    <SHIPADDR>
    <STREET>2 Avocet Drive</STREET>
    <CITY>Redwood Shores</CITY>
    <STATE>CA</STATE>
    </SHIPADDR>
    </PO>
    Look into the documentation: Oracle9i XML Database Developer's Guide - Oracle XML DB for more details.
    Hope that helps.
    OTN team@IDC

  • CAST,CONVERT and SUBSTRING

    Hi,
    I have a coumn called Date
    DAte: 2014-05-12 00:00:00.000 (yyyy-mm-dd time)
    Now i need to change this to two Column called Season and DateMM
    where 
    DateMM: 201405 (yyyymm) and 
    season : FA14  ( since its a fifth month I want to call it as FA  and the 14 is from 2014).
    Anyone who can help?
    SPPandey

    Are the seasons defined
    considering northern or southern hemisphere?
    The
    beginning and
    end of each season
    varies
    according to the hemisphere
    and even
    country.Vide
    equinox and
    solstice.
    Try
    -- code #1
    ;with
    Frank as (
    SELECT [Date], AAAAMM= Convert(char(6), [Date], 112),
    MMDD= Right( Convert(char(8), [Date], 112), 4)
    from ...
    SELECT [Date],
    DateYM= AAAAMM,
    Season= case when MMDD >= '0320' and MMDD < '0620' then 'AU'
    when MMDD >= '0621' and MMDD < '0922' then 'WI'
    when MMDD >= '0923' and MMDD < '1221' then 'SP'
    else 'SU' end +
    Right('00' + Cast((Year([Date]) % 100) as varchar), 2)
    from Frank;
      or
    -- code #2
    CREATE FUNCTION SeasonYear (@Date date)
    returns char(2) as
    begin
    declare @MMDD char(4), @S char(2);
    set @MMDD= Right( Convert(char(8), @Date, 112), 4);
    set @S= case when @MMDD >= '0320' and @MMDD < '0620' then 'AU'
    when @MMDD >= '0621' and @MMDD < '0922' then 'WI'
    when @MMDD >= '0923' and @MMDD < '1221' then 'SP'
    else 'SU' end;
    return @S;
    end;
    go
    SELECT [Date],
    DateYM= Convert(char(6), [Date], 112),
    Season= dbo.SeasonYear([Date]) +
    Right(Convert(char(4), [Date], 112), 2)
    from ...;
    José Diz     Belo Horizonte, MG - Brasil

  • Converting XMLSequence to XMLDocument

    I use a PreparedXQuery class to run an XQuery.
    The result is an XMLSequence instance.
    I want to convert it to an XMLDocument.
    How can I do that?
    Regards
    Roger van de Kimmenade

    XMLDocument d = new XMLDocument();
    d.appendChild(yourfragment);

  • Problem converting XMLTYPE data into database rows.

    Can anyone help with this ?
    I�ve got an XML document like the following:
    <ROWSET><ROW>><NAME>John</NAME></ROW></ROWSET>
    I want to extract the �Name� element and insert it into a table that has one column:
    create table employee
    (empname varchar2(50));
    The following PL/SQL block does the job:
    begin
    insert into employee
    (empname)
    select extractvalue(value(xmltab),'/ROW/NAME')
    from table(xmlsequence(extract(xmltype('
    <ROWSET><ROW>><NAME>Cpty 1</NAME></ROW></ROWSET>')
    ,'/ROWSET/ROW'))) xmltab;
    commit;
    end;
    However, instead of having the XML string embedded in the actual SQL statement I would like to assign the XML string to a variable (of type XMLTYPE) and refer to the variable in the SQL statement i.e.
    declare
    v_xml xmltype;
    begin
    v_xml := xmltype(�<ROWSET><ROW>><NAME>John</NAME></ROW></ROWSET>�)
    insert into employee
    (empname)
    select extractvalue(value(xmltab),'/ROW/NAME')
    from table(xmlsequence(extract(v_xml,'/ROWSET/ROW'))) xmltab;
    commit;
    end;
    When I run this I get the following exception:
    ORA-22905 Cannot access rows from a non-nested table.
    I can�t understand why the first example works but the second example doesn�t. I want to get the second version working because eventually I want to put this code in a stored proc that excepts an xmltype parameter.
    Any help would be much appreciated.

    Hi
    Now I understand why you want to use an insert as select...
    The following PL/SQL code should work...
    declare
    v_xml xmltype;
    begin
    v_xml := xmltype('<ROWSET><ROW><NAME>John</NAME></ROW></ROWSET>');
    insert into employee (empname)
    select extractvalue(value(t),'/NAME')
    from table(cast(xmlsequence(extract(v_xml, '/ROWSET/ROW/NAME'))as xmlsequencetype)) t;
    commit;
    end;
    Chris

  • How to convert XMLTYPE data into CLOB without using getclobval()

    Please tell me how to convert data which is stored in the table in XMLTYPE column to a CLOB.
    When i use getClobVal(), i get an error. So please tell me some other option except getClobVal()

    CREATE OR REPLACE PACKAGE BODY CONVERT_XML_TO_HTML AS
         FUNCTION GENERATE_HTML(TABLE_NAME VARCHAR2, FILE_NAME VARCHAR2, STYLESHEET_QUERY VARCHAR2, WHERE_CLAUSE VARCHAR2, ORDERBY_CLAUSE VARCHAR2) RETURN CLOB IS
         lHTMLOutput XMLType;
         lXSL CLOB;
              lXMLData XMLType;
              FILEID UTL_FILE.FILE_TYPE;
              HTML_RESULT CLOB;
              SQL_QUERY VARCHAR2(300);
              WHERE_QUERY VARCHAR2(200);
              fileDirectory VARCHAR2(100);
              slashPosition NUMBER;
              actual_fileName VARCHAR2(100);
              XML_HTML_REF_CUR_PT XML_HTML_REF_CUR;
              BEGIN
                   IF WHERE_CLAUSE IS NOT NULL AND ORDERBY_CLAUSE IS NOT NULL THEN
                   SQL_QUERY := 'SELECT * FROM ' || TABLE_NAME ||' WHERE ' || WHERE_CLAUSE || ' ORDER BY ' || ORDERBY_CLAUSE;
                        ELSE IF WHERE_CLAUSE IS NOT NULL AND ORDERBY_CLAUSE IS NULL THEN
                             SQL_QUERY := 'SELECT * FROM ' || TABLE_NAME || ' WHERE ' || WHERE_CLAUSE;
                             ELSE IF WHERE_CLAUSE IS NULL AND ORDERBY_CLAUSE IS NOT NULL THEN
                                  SQL_QUERY := 'SELECT * FROM ' || TABLE_NAME || ' ORDER BY ' || ORDERBY_CLAUSE;
                                  ELSE IF WHERE_CLAUSE IS NULL AND ORDERBY_CLAUSE IS NULL THEN
                                  SQL_QUERY := 'SELECT * FROM ' || TABLE_NAME;
                   END IF;
                        END IF;
                             END IF;
                                  END IF;
                   OPEN XML_HTML_REF_CUR_PT FOR SQL_QUERY;
              lXMLData := GENERATE_XML(XML_HTML_REF_CUR_PT);
                   --lXSL := GET_STYLESHEET(STYLESHEET_QUERY);
                                  if(lXMLData is not null) then
                                  dbms_output.put_line('lXMLData pass');
                                  else
                                            dbms_output.put_line('lXMLData fail');
                   end if;
                   lHTMLOutput := lXMLData.transform(XMLType(STYLESHEET_QUERY));
                   --INSERT INTO TEMP_CLOB_TAB2 VALUES(CLOB(lHTMLOutput));
                   if(lHTMLOutput is not null) then
                                  dbms_output.put_line('lHTMLOutput pass');
                                  else
                                            dbms_output.put_line('lHTMLOutput fail');
                   end if;
                   HTML_RESULT := lHTMLOutput.getclobVal();
                   if(HTML_RESULT is not null) then
                                  dbms_output.put_line('HTML_RESULT pass'||HTML_RESULT);
                                  else
                                            dbms_output.put_line('HTML_RESULT fail');
                   end if;
                   -- If the filename has been supplied ...
         IF FILE_NAME IS NOT NULL THEN
    -- locate the final '/' or '\' in the pathname ...
         slashPosition := INSTR(FILE_NAME, '/', -1 );
         IF slashPosition = 0 THEN
         slashPosition := INSTR(FILE_NAME,'\', -1 );
         END IF;
    -- separate the filename from the directory name ...
         fileDirectory := SUBSTR(FILE_NAME, 1,slashPosition - 1 );
         actual_fileName := SUBSTR(FILE_NAME, slashPosition + 1 );
                   END IF;
                        DBMS_OUTPUT.PUT_LINE(fileDirectory||' ' ||actual_fileName);
                   FILEID := UTL_FILE.FOPEN(fileDirectory,actual_fileName, 'W');
                   UTL_FILE.PUT_LINE(FILEID, '<title> hi </title>');
              UTL_FILE.PUT_LINE(FILEID, HTML_RESULT);
                   UTL_FILE.FCLOSE (FILEID);
    DBMS_OUTPUT.PUT_LINE('CLOB SIZE'||DBMS_LOB.GETLENGTH(HTML_RESULT));               
                   RETURN HTML_RESULT;
                   --RETURN lHTMLOutput;
              EXCEPTION
                        WHEN OTHERS
                             THEN DBMS_OUTPUT.PUT_LINE('ERROR!!!!!!!!!!!!');
              END GENERATE_HTML;
         FUNCTION GENERATE_XML(XML_HTML_REF_CUR_PT XML_HTML_REF_CUR) RETURN XMLType IS
              qryCtx DBMS_XMLGEN.ctxHandle;
              result CLOB;
              result1 xmltype;
              BEGIN
                   qryCtx := DBMS_XMLGEN.newContext(XML_HTML_REF_CUR_PT);
                   result := DBMS_XMLGEN.getXML(qryCtx);
                   --dbms_output.put_line(result);
                   result1 := xmltype(result);
                   INSERT INTO temp_clob VALUES(result);
                   if(result1 is not null) then
                                  dbms_output.put_line('pass');
                                  else
                                            dbms_output.put_line('fail');
                   end if;
                        return result1;
                        DBMS_XMLGEN.closeContext(qryCtx);
         END GENERATE_XML;     
    END CONVERT_XML_TO_HTML;
    This is the code which i am using to generate the XML and subsequently to generate the HTML output out of that using a XSL stylesheet.
    The error is Numeric or value error..

  • Converting xmltype to document/node

    I am trying to take XMLType and create a DOMDocument or DOMNode. How can this be done.
    Thank you,
    Jim

    procedure disableDefaultTables(xmlschema in out xmltype)
    as
    SCHEMA_DOM DBMS_XMLDOM.DOMDOCUMENT;
    SCHEMA_ELEMENT DBMS_XMLDOM.DOMELEMENT;
    NODELIST DBMS_XMLDOM.DOMNODELIST;
    ATTRLIST DBMS_XMLDOM.DOMNODELIST;
    ELEMENT_ELEMENT DBMS_XMLDOM.DOMELEMENT;
    DEFAULT_TABLE_ATTR DBMS_XMLDOM.DOMATTR;
    begin
    SCHEMA_DOM := DBMS_XMLDOM.newDOMDocument(xmlSchema);
    SCHEMA_ELEMENT := DBMS_XMLDOM.getDocumentElement(SCHEMA_DOM);
    NODELIST := DBMS_XMLDOM.getChildrenByTagName(SCHEMA_ELEMENT,'element');
    FOR i in 0 .. (DBMS_XMLDOM.getLength(NODELIST) - 1) LOOP
    ELEMENT_ELEMENT := DBMS_XMLDOM.makeElement(DBMS_XMLDOM.item(NODELIST,i));
    DEFAULT_TABLE_ATTR := DBMS_XMLDOM.getAttributeNode(ELEMENT_ELEMENT,'defaultTable',xdb_namespaces.XDBSCHEMA_NAMESPACE);
    if DBMS_XMLDOM.isNULL(DEFAULT_TABLE_ATTR) then
    DEFAULT_TABLE_ATTR := DBMS_XMLDOM.createAttribute(SCHEMA_DOM,'xdb:defaultTable',xdb_namespaces.XDBSCHEMA_NAMESPACE);
    DEFAULT_TABLE_ATTR := DBMS_XMLDOM.setAttributeNode(ELEMENT_ELEMENT,DEFAULT_TABLE_ATTR);
    end if;
    end loop;
    end;

  • Converting XMLType to String

    Hi,
    I am storing XML in one database column (Account_Info) which is of data type XMLType. Now in java how do I retrieve that value?
    I do not know if I can do rs.getString("Account_Info") as Account_Info is an XML. I am using oracle database
    Thanks

    the things you can find on Oracle's website: http://www.oracle.com/technology/sample_code/tech/java/codesnippet/jsp/xmltype/index.html
    darn forum software ate the link

  • Problem casting org.w3c.dom.Document to oracle.xml.parser.v2.XMLDocument

    I have the following problem:
    I get my xml-documents as an XMLType from the database and want to compare these using the supplied Oracle class oracle.xml.differ.XMLDiff (i use the java version supplied with Oracle 9i r2).
    XMLType.getDOM() returns the xml-document as a org.w3c.dom.Document,
    what i need for oracle.xml.differ.XMLDiff is a oracle.xml.parser.v2.XMLDocument.
    How can i cast/convert between these two formats?
    thanks!
    p.s. cross-posting with Re: Casting/Converting XMLType to XMLDocument? (but i think this forum is more relevant).

    Hi,
    thanks for the suggestion: i have written the code shown below. It results in a casting error.
    As far as i know, i don't use a oracle.xdb.dom.XDBDocument, i only use a oracle.xdb.XMLType as the input parameter for my conversion-method:
    any new suggestions ???
    p.s. the second method which is commented does work, but is a bit verbose.
       private static oracle.xml.parser.v2.XMLDocument convert2XMLDocument(XMLType xml) {
         // simple version (should work according to tech. doc. 9i r2/ 10g r1 database)
         oracle.xml.parser.v2.XMLDocument doc = null;
         try {
            // n.b. probleem is dat XMLType.getDOM() een w3c.Document object teruggeeft ipv een oracle.XMLDocument.
            System.out.println("convert2XMLDocument(): casting w3c.Document naar oracle.XMLDocument.");
            doc = (oracle.xml.parser.v2.XMLDocument) xml.getDOM(); // public org.w3c.dom.Document getDOM()
            System.out.println("convert2XMLDocument(): done casting w3c.Document naar oracle.XMLDocument.");
         catch (Exception e) {
            e.printStackTrace(System.out);
        return doc;
       private static XMLDocument convert2XMLDocument(XMLType xml) {
         // complex version: works ok !!!
         XMLDocument doc = null;
         try{
            DOMParser parser  = new DOMParser();
            parser.setValidationMode(oracle.xml.parser.v2.XMLParser.NONVALIDATING);
            parser.setPreserveWhitespace (true);   
            parser.parse(new StringReader(xml.getStringVal()));
            doc = parser.getDocument();
        catch ( XMLParseException e ) {
          e.printStackTrace(System.out);
        catch ( SQLException e ) {
          e.printStackTrace(System.out);
        catch ( Exception e ) {
          e.printStackTrace(System.out);
        return doc;
    convert2XMLDocument(): casting w3c.Document naar oracle.XMLDocument.
        java.lang.ClassCastException: oracle.xdb.dom.XDBDocument
         at pnb.bdb.xml.testJDBC.convert2XMLDocument(testJDBC.java:305)
         at pnb.bdb.xml.testJDBC.main(testJDBC.java:187)

  • Unable to cast object of type OracleXmlType to type XmlDocument

    Hello All:
    I have an Oracle Procedure that is taking an XML Document as an output parameter.
    oCommand.Parameters.Add("errorrecord", OracleDbType.XmlType).Value = System.DBNull.Value;
    oCommand.Parameters["errorrecord"].Direction = System.Data.ParameterDirection.Output;
    When I try to cast this as an XmlDocument so I can set it to my ErrorRecord variable (defined as XmlDocument) and pass it back out of the Web-Service
    ErrorRecord = (XmlDocument)oCommand.Parameters["p_errorrecord"].Value;
    I get the following error: "Unable to cast object of type 'Oracle.DataAccess.Types.OracleXmlType' to type 'System.Xml.XmlDocument'"
    How do I cast / convert the Oracle XMLType back to a .Net XMLDocument to pass out of the function?
    Thanks

    No, I have not tried that yet, but I admit I don't fully understand the syntax in the document posted.
    oCommand.Parameters.Add("p_errorrecord", OracleDbType.XmlType).Value = System.DBNull.Value;
    ErrorRecord = GoCommand.Parameters["errorrecord"].Value; (this is returned as XmlType)
    I don't quite understand the syntax in the posted URL:
    Declaration
    // C#
    public XmlDocument GetXmlDocument();
    How am I to use this to get the XMLDocument?

  • XMLTYPE from Pooled Connection throws ClassCastException

    Hello,
    I am developing a Java web application using Developer 10.1.3 that is tied to an Oracle database through a connection pool. The application is utilizing Oracle's xmldb libraries in order to store xml documents as XMLTYPE in the database.
    The troubles I'm running into are in the creation of an XMLType object. The line of code where everything blows up is:
         XMLType xType = XMLType.createXML(connection, xmldocument);
    The xml document is fine, the problem is with the connection. I keep getting a "ClassCastException: oracle_jdbc_driver_LogicalConnection_Proxy".
    The thing is, when I connect directory to the database through a single connection, everything works just fine. It's only when getting a connection from a pooled location.
    I've been banging my head trying to figure this out for over a week, so any help would be greatly appreciated.

    For anyone interested I figured out a solution. Instead of insert an XMLType directly, I'm converting the XML to a CLOB, inserting the clob and casting to XMLType within the sql. Here's the code:
    insert into xml_table (xml_field) values(XMLType(?)); //? = CLOB
    Later

  • Array of XMLType

    I'm getting the following error when attempting to cast an array of XMLType to OPAQUE[]:
    java.sql.SQLException: Internal Error: makeJavaArray doesn't support type 2007
    I was wondering if there were some smarter people out there that know whether or not I can do an array of XMLType through Java.
    Thanks,
    Joe
    The type:
    create or replace
    type xml_tbl as table of xmltype;The procedure:
    create or replace
    procedure getXml_tbl(p_out out nocopy xml_tbl)
    as
    begin
    select b bulk collect into p_out
    from my_xml;
    end;The method:
        public void getXmlTable(Connection conn) {
            //table of XMLType
            String sqlString =
                "begin getXml_tbl(?); end;"; //return a table of XMLType
            OracleCallableStatement cs = null;
            Connection dbConn = conn;
            oracle.sql.ARRAY rArray = null;
            OPAQUE[] op = null;
            System.out.print("statement string=" + sqlString + "\n");
            // Output: statement string=begin getXml_tbl(?); end;
            try {
                // Setup callable statement
                cs = (OracleCallableStatement)dbConn.prepareCall(sqlString);
                // Register out parameter of the proc
                cs.registerOutParameter(1, OracleTypes.ARRAY, "XML_TBL");
                // Execute callable statement
                cs.execute();
                // Shove the results from the callable statement into an oracle.sql.ARRAY
                rArray = cs.getARRAY(1);
                // Print out the type:
                System.out.println("rArray is of type: " +
                                   rArray.getSQLTypeName());
                // Output: rArray is of type: JCHANCELLOR.XML_TBL
                // Print out the base type of the array:
                System.out.println("rArray's base type is: " +
                                   rArray.getBaseType());
                // Output: rArray's base type is: 2007
                // Attempting to put the Array in something that can be read by Java
                // and then be used by xml:
                op = (OPAQUE[])rArray.getArray();
                // SQLException occurs:
                // Internal Error: makeJavaArray doesn't support type 2007
            } catch (SQLException e) {
                e.printStackTrace();
                System.out.println(e.getMessage());
            } finally {
                try {
                    dbConn.close();
                    cs.close();
                } catch (SQLException e) {
                    e.printStackTrace();
                    System.out.println(e.getMessage());
        }

    Hi Joe
    Did you find out a way to do this? Convert XMLTYpe array to a java array.
    The solutions like trunign into a select statement won't work for me as i need to use a BULK COLLECT. This particular table contains more than a million rows.
    Rgds
    Ramraj

  • XMLTYPE from pooled connection

    Hello,
    I am using JDeveloper 10.1.3 and am trying to create an XMLTYPE from a pooled connection. Problem is I keep getting a ClassCastException: oracle_jdbc_driver_LogicalConnection_Proxy. I have no troubles whith a single connection to the database, only with a pooled connection.
    Any help would be appreciated.

    For anyone interested I figured out a solution. Instead of insert an XMLType directly, I'm converting the XML to a CLOB, inserting the clob and casting to XMLType within the sql. Here's the code:
    insert into xml_table (xml_field) values(XMLType(?)); //? = CLOB
    Later

  • How to Convert MM/DD/YYYY to YYYY/MM/DD in SQL Reporting Services

    i am having difficulty of converting a parameter field, called @startdate, on sql reporting services report to YYYY/MM/DD format.  the parameter @Startdate was set to Data/Time.  @Startdate is 6/1/2014 12:00:00 and I want to convert it
    to 2014/06/01.  I want to compare @Startdate with a column in database called Begindate which is in format of YYYY/MM/DD hh:mm:ss.  I tried the followings
    select * from Atable where cast(Atable.Begindate as date) >= cast(@Startdate as date)
    select * from Atable where cast(Atable.Begindate as date >= cast(convert(datetime, @Startdate) as date)
    SQL Reporting Services only gives me Text, Boolean, Date/Time, Integer and Float.
    Regards,

    Hi Elmucho,
    Sorry for the delay. I tested with the sample data you provided, however everything works well in-house. Could you please creste a new report and check the result. Here are the steps I performed:
    1.  Create a table and insert the following data:
    Name (varchar(50))    Begindate (datetime, not null)    
    Lastdate (datetime, not null)
    bob                          
    2008-01-01 08:08:08.000      2010-10-10  
    10:10:10.000
    alice                         
    2010-10-10 10:10:10.00       2011-11-11
      11:11:11.000
    smith                       
    2011-11-11 11:11:11.00       2012-12-12   
    12:12:12.000    
    2. Open SQL Server Data Tools, create the data source and add the dataset with the below query:
    SELECT     Name, Begindate, Lastdate
    FROM         [tablename ]
    WHERE     (CAST(Begindate AS date) >= CAST(@Startdate AS date)) AND (CAST(Lastdate AS date) <= CAST(@Enddate AS date))
    3. Then, click execute button, it prompts for inputting the parameter value.
    @Startdate        
    6/1/2008
    @Enddate          
    5/1/2014
    Enter the date and press OK.
    4. Here is the result in the query designer:
    Insert a table and fields. Save the report and preview:
    Thanks.
    Tracy Cai
    TechNet Community Support

Maybe you are looking for

  • Photos/Pictures viewd in Safari

    Hey all, I was just wondering if there is anyway of saving photos/pictures that you view in Safari to the iPhone so that you can use these as wallpaper? It seems silly to have to use a PC to download the picture and then synch to your iPhone when all

  • EDI invoice for Batch qty.

    Dear experts, in a special scenario I would like that in the EDI outbound invoice Batch qty. which is not showing for segment E1EDP19 which is showing only the Batch nr., I wanted to use a BADI for EDI outbound invoice which uses the logic for transf

  • DW8 for Print Layout?

    Recently we created a newsletter for e-mailing and posting on our site. This month, we would like to use the HTML document and manipulate it so we can adapt it for a print layout. For example, we would add page breaks, adjust margins, remove or modif

  • Change row color

    I am developing an application using Oracle 6i Forms and Developer,and i am new to it. I have a datablock on a canvas and i am trying to do sth: When the user clicks on a row of the datablock,the entire row background color should change to green and

  • Adobe InDesign CS3 not running?

    i get a crash report as soon as i try to run Adobe InDesign CS3 any help on it? i as something that they are working on it? how soon can i see this happening is there any thing I can do to fix it? i need this for school by monday to get this big proj