--- title: "Specifying Arithmetic Operators in XPath Queries (SQLXML 4.0) | Microsoft Docs" ms.custom: "" ms.date: "03/16/2017" ms.prod: "sql-server-2016" ms.reviewer: "" ms.suite: "" ms.technology: - "dbe-xml" ms.tgt_pltfrm: "" ms.topic: "reference" helpviewer_keywords: - "arithmetic operators" - "XPath operators [SQLXML]" - "XPath queries [SQLXML], arithmetic operators" - "operators [SQLXML]" ms.assetid: fdfbc87d-759f-4abc-acf5-a21de01f78d3 caps.latest.revision: 26 author: "douglaslMS" ms.author: "douglasl" manager: "jhubbard" --- # Specifying Arithmetic Operators in XPath Queries (SQLXML 4.0) The following example shows how arithmetic operators are specified in XPath queries. The XPath query in this example is specified against the mapping schema contained in SampleSchema1.xml. For information about this sample schema, see [Sample Annotated XSD Schema for XPath Examples (SQLXML 4.0)](../../../relational-databases/sqlxml-annotated-xsd-schemas-xpath-queries/samples/sample-annotated-xsd-schema-for-xpath-examples-sqlxml-4-0.md). ## Examples ### A. Specify the * arithmetic operator This XPath query returns **\** elements that satisfy the predicate specified: ``` /child::OrderDetail[@UnitPrice * @Quantity = 12.350] ``` In the query, `child` is the axis and `OrderDetail` is the node test (TRUE if **OrderDetail** is an **\**, because the **\** node is the primary node for the **child** axis). For all the **\** element nodes, the test in the predicate is applied, and only those nodes that satisfy the condition are returned. > [!NOTE] > The numbers in XPath are double-precision floating-point numbers, and comparing floating-point numbers as in the example causes rounding. ##### To test the XPath query against the mapping schema 1. Copy the [sample schema code](../../../relational-databases/sqlxml-annotated-xsd-schemas-xpath-queries/samples/sample-annotated-xsd-schema-for-xpath-examples-sqlxml-4-0.md) and paste it into a text file. Save the file as SampleSchema1.xml. 2. Create the following template (ArithmeticOperatorA.xml) and save it in the directory where SampleSchema1.xml is saved. ``` /OrderDetail[@UnitPrice * @OrderQty = 12.350] ``` The directory path specified for the mapping schema (SampleSchema1.xml) is relative to the directory where the template is saved. An absolute path also can be specified, for example: ``` mapping-schema="C:\MyDir\SampleSchema1.xml" ``` 3. Create and use the SQLXML 4.0 Test Script (Sqlxml4test.vbs) to execute the template. For more information, see [Using ADO to Execute SQLXML 4.0 Queries](../../../relational-databases/sqlxml/using-ado-to-execute-sqlxml-4-0-queries.md). ``` Here is the partial result set of the template execution: ... ```