
USE xmldb
GO

-- assume the same xml_tab as in previous examples
-- comparison to NULL works
SELECT the_id FROM xml_tab
WHERE xml_col IS NULL
GO

-- illegal
SELECT xml_col FROM xml_tab
GROUP BY xml_col
GO

SELECT xml_col FROM xml_tab
ORDER BY xml_col
GO

SELECT xml_col FROM xml_tab
WHERE xml_col = '<doc2/>'
GO

SELECT SUBSTRING(xml_col,1,2) FROM xml_tab
GO

-- casting to string allows this to work
SELECT xml_col from xml_tab
WHERE CAST(xml_col AS VARCHAR) = '<doc2/>'
GO