关于 Contact.AdditionalContactInfo xml 列

Contact 表存储常用的客户联系信息(如姓名、电话号码和电子邮件地址)。此表还包含 xml 类型的名称为 AdditionalContactInfo 的列。

客户可能有多个电话、移动电话、电子邮件和寻呼机。因为在设计时无法获得其他联系点的确切数目,所以不可能知道需要多少列来存储该信息。可以不创建多个用于包含该信息的列然后不得不存储 NULL 值,而创建一个 XML 类型的列来存储包含每个客户的其他联系信息的 XML 文档。

AdventureWorks 数据库中,此列名为 AdditionalContactInfo。然后,就可以与其他应用程序共享此附加联系信息。例如,此信息对客户关系管理 (CRM) 应用程序可能非常有用。

CRM 也可以在此列中存储联系信息。存储的信息可以包括与客户联系的日期和会话说明。

这是一个已类型化的 xml 列。可以在此 Microsoft 网站上查看用于此列的架构。此列使用下列架构:

  • AdventureWorks ContactInfo 架构
  • AdventureWorks ContactRecord 架构
  • AdventureWorks ContactTypes 架构

此列中存储的示例 XML 实例

下面是示例 XML 实例:

<AdditionalContactInfo xmlns="https://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ContactInfo" xmlns:crm="https://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ContactRecord" xmlns:act="https://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ContactTypes">
  <act:telephoneNumber>
    <act:number>111-111-1111</act:number>
    <act:SpecialInstructions>
        Call only after 5PM.
     </act:SpecialInstructions>
  </act:telephoneNumber>
  Note that customer has second home at this address.
 <act:homePostalAddress>
   <act:Street>123 Oak</act:Street>
   <act:City>Seattle</act:City>
   <act:StateProvince>WA</act:StateProvince>
   <act:PostalCode>777</act:PostalCode>
   <act:CountryRegion>USA</act:CountryRegion>
   <act:SpecialInstructions>If correspondance to the primary address 
        fail, try this one</act:SpecialInstructions>
 </act:homePostalAddress>
  Customer provided additional email address.          
 <act:eMail>
   <act:eMailAddress>customer1@xyz.com</act:eMailAddress>
  <act:SpecialInstructions>Dont send emails for urgent issues. Instead use
        this emergency contact phone
        <act:telephoneNumber>
          <act:number>112-111-1111</act:number>
        </act:telephoneNumber>.
  </act:SpecialInstructions>
</act:eMail>
<crm:ContactRecord date="2001-06-02Z">This customer is interested in 
            puchasing a high end bicycles for his family. The customer 
            contacted Mike in sales.
  </crm:ContactRecord>
</AdditionalContactInfo>

运行以下查询可以找到其他 XML 实例:

select AdditionalContactInfo
from   Person.Contact

请参阅

概念

示例 XML 应用程序

帮助和信息

获取 SQL Server 2005 帮助