Load specific element from XML I have the following xml:

&lt;root&gt;
 &lt;123 type="line"&gt;
  &lt;aa type="item"&gt;
   &lt;value&gt;1&lt;/value&gt;
  &lt;/aa&gt;
 &lt;/123&gt;
 &lt;234 type="line"&gt;
  &lt;bb type="item"&gt;
   &lt;value&gt;2&lt;/value&gt;
  &lt;/bb&gt;
 &lt;/234&gt;
&lt;/root&gt;


How can I from bulk loading the xml into a database table (field xmldata)
query the xml so I get all values under type="line" and then all values under type="item" so I can then get to the value attribute. I can't hard code the attribute (eg 123) because it changes all the time, but the type value will remain constant.
You should use the nodes() method of the XML data type to shred your XML.

If I understand you correctly you want to fetch the nodes from the root node where the attribute type is line and from that node you want the nodes where the attribute type is 'item'. I will just assume that the XML you have provided with numeric node names is not the actual XML you are using but that the node names are valid XML names.

declare @XML xml = '
&lt;root&gt;
  &lt;A123 type="line"&gt;
    &lt;aa type="item"&gt;
      &lt;value&gt;1&lt;/value&gt;
    &lt;/aa&gt;
  &lt;/A123&gt;
  &lt;B234 type="line"&gt;
    &lt;bb type="item"&gt;
      &lt;value&gt;2&lt;/value&gt;
    &lt;/bb&gt;
  &lt;/B234&gt;
&lt;/root&gt;';

select T.X.value('text()[1]', 'int') as Value
from @XML.nodes('/root/*[@type = "line"]/*[@type = "item"]/value') as T(X)


A breakdown of the xPath in the nodes function:

From /root give me all nodes /root/* where the attribute type is line /root/*[@type = "line"] and from there give me all nodes /root/*[@type = "line"]* where the attribute type is item /root/*[@type = "line"]/*[@type = "item"]. 

Finally get the value node /root/*[@type = "line"]/*[@type = "item"]/value and extract the text node using the value() function.