--- title: "Specify a root element for use with FOR XML | Microsoft Docs" ms.date: "03/01/2017" ms.prod: sql ms.prod_service: "database-engine" ms.reviewer: "" ms.technology: xml ms.topic: conceptual helpviewer_keywords: - "RAW mode, specifying root element example" - "RAW mode, with FOR XML example" ms.assetid: bcc54b11-0713-4e43-8dbe-d6f3ad1993b5 author: MightyPen ms.author: genemi ms.custom: "seo-lt-2019" --- # Example: Specifying a Root Element for the XML Generated by FOR XML [!INCLUDE[appliesto-ss-asdb-xxxx-xxx-md](../../includes/appliesto-ss-asdb-xxxx-xxx-md.md)] By specifying the `ROOT` option in the `FOR XML` query, you can request a single, top-level element for the resulting XML, as shown in this query. The argument specified for the `ROOT` directive provides the root element name. ## Example ``` USE AdventureWorks2012; GO SELECT ProductModelID, Name FROM Production.ProductModel WHERE ProductModelID=122 or ProductModelID=119 or ProductModelID=115 FOR XML RAW, ROOT('MyRoot') GO ``` This is the result: ``` ``` ## See Also [Use RAW Mode with FOR XML](../../relational-databases/xml/use-raw-mode-with-for-xml.md)