title: How can I query a value from SQL Server XML column
body: <p>I have following XML stored in a XML column in a SQL Server database table.</p>
  
  <pre><code>&lt;MachineInfo&gt;
    &lt;OperatingSystem Caption="Microsoft Windows Server 2008 R2 Enterprise " InstallDate="2012-10-09T07:59:23Z" LastBootUpTime="2013-11-13T11:53:22Z" Manufacturer="Microsoft Corporation" OperatingSystemSKU="10" Organization="Organization" OSLanguage="1033" OSProductSuite="274" OSType="18" SerialNumber="00000-001-0000000-00000" ServicePackMajorVersion="1" ServicePackMinorVersion="0" Version="6.1.7601" WindowsDirectory="C:\Windows" /&gt;
    &lt;ComputerSystem Caption="SERVERNAME" DNSHostName="servername" Domain="test.testdomain.com" DomainRole="4" Manufacturer="VMware, Inc." Model="VMware Virtual Platform" NumberOfLogicalProcessors="1" NumberOfProcessors="1" PartOfDomain="1" Roles="[ LM_Workstation ][ LM_Server ][ Backup_Domain_Controller ][ NT ][ Backup_Browser ][ DFS ]" SystemType="x64-based PC" TotalPhysicalMemory="4294500352" Workgroup="" /&gt;
    &lt;Processors&gt;
      &lt;Processor AddressWidth="64" Architecture="9" Caption="Intel64 Family 6 Model 37 Stepping 1" DataWidth="64" ExtClock="" Family="2" L2CacheSize="0" L2CacheSpeed="" L3CacheSize="0" L3CacheSpeed="0" Manufacturer="GenuineIntel" MaxClockSpeed="3059" Name="Intel(R) Xeon(R) CPU           X5675  @ 3.07GHz" NumberOfCores="1" NumberOfLogicalProcessors="1" OtherFamilyDescription="" ProcessorId="0FABFBFF00020651" ProcessorType="3" Revision="9473" Stepping="" UniqueId="" Version="" VoltageCaps="2" /&gt;
    &lt;/Processors&gt;
    &lt;TimeZone Bias="0" Caption="(UTC) Dublin, Edinburgh, Lisbon, London" /&gt;
    &lt;DiskDrives&gt;
      &lt;DiskDrive DeviceID="\\.\PHYSICALDRIVE0" InterfaceType="SCSI" Manufacturer="(Standard disk drives)" Model="VMware Virtual disk SCSI Disk Device" Partitions="2" Size="42944186880" /&gt;
      &lt;DiskDrive DeviceID="\\.\PHYSICALDRIVE1" InterfaceType="SCSI" Manufacturer="(Standard disk drives)" Model="VMware Virtual disk SCSI Disk Device" Partitions="3" Size="42944186880" /&gt;
    &lt;/DiskDrives&gt;
  &lt;/MachineInfo&gt;
  </code></pre>
  
  <p>I'd like to get value of ComputerSystem Caption</p>
  
  <p>Table name: <code>Agent</code>
  Column name: <code>MachineInfo</code></p>