DECLARE @TableData XML,@TableSchema XML
SELECT @TableSchema = (
select column_name,data_type,
case(is_nullable)
when 'YES' then 'true'
else 'false'
end as is_nullable,
CHARACTER_MAXIMUM_LENGTH as Charlen
from information_schema.columns [column] where table_name = 'lkpActivityType' for xml auto,root('Table'))
SELECT @TableData = (SELECT * FROM lkpActivityType Row FOR XML AUTO, BINARY BASE64,root('lkpActivityType'))
SELECT @TableSchema,@TableDataThis code snippet is for Table schema and Data in XML.
