On Transact SQL language the XML is an xml data type and can store xml instances in a column, or a variable of xml type.
XML syntax:
xml ( [ CONTENT | DOCUMENT ] xml_schema_collection )
XML example:
USE model;
GO
DECLARE @xml AS xml;
SELECT @xml =
(
SELECT
CONCAT (id, ', ',name, ', ',price)
FROM courses
WHERE id=3
);
SELECT @xml;
GO
USE model;
GO
DECLARE @xmlDoc xml
SET @xmlDoc =
(SELECT id, Name
FROM courses
FOR XML AUTO, TYPE)
SELECT @xmlDoc
GO