Create a function to retrieve all xml fields from a table

  • I have more than one xml fields in a table.I need to create a function to retrieve all of the xml fields

    How should i o that.Please help me for that.I am new to xml datatype

  • select *from tablename for xml auto

  • If you are looking for all XML columns in a database

    SELECT * FROM INFORMATION_SCHEMA.COLUMNS

    WHERE DATA_TYPE = 'XML'

    This is the result from my AdventureWorks2008 DB

    TABLE_CATALOGTABLE_SCHEMATABLE_NAMECOLUMN_NAMEORDINAL_POSITIONCOLUMN_DEFAULTIS_NULLABLEDATA_TYPE

    AdventureWorks2008ProductionIllustrationDiagram2NULLYESxml

    AdventureWorks2008HumanResourcesJobCandidateResume3NULLYESxml

    AdventureWorks2008ProductionProductModelCatalogDescription3NULLYESxml

    AdventureWorks2008ProductionProductModelInstructions4NULLYESxml

    AdventureWorks2008SalesStoreDemographics4NULLYESxml

    AdventureWorks2008PersonPersonAdditionalContactInfo10NULLYESxml

    AdventureWorks2008PersonPersonDemographics11NULLYESxml

    AdventureWorks2008HumanResourcesvEmployeeAdditionalContactInfo18NULLYESxml

    AdventureWorks2008SalesvIndividualCustomerDemographics18NULLYESxml

    AdventureWorks2008dboDatabaseLogXmlEvent8NULLNOxml

    SQLServerNewbieMCITP: Database Administrator SQL Server 2005

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply