You need to approach this a bit differently: since you have a list of Element nodes, I would suggest you create a list of nodes and then pick the right one from that list - something like this: SELECT AED.Element. Value('(@Label)1', 'varchar(100)') as ControlLabel FROM Control CROSS APPLY Control_XML. Nodes('/AEDControl/Elements/Element') AS AED(Element) WHERE AED.Element.
Value('(@ElementGU)1', 'uniqueidentifier') = @SelectedValueGU I don't know how you want to select from your base table - whether you want to have a WHERE clause or something - but the CROSS APPLY basically takes the XML field and creates a "pseudo-table" called AED. Element from the nodes given in the XPath expression, and cross-applies those to the base table. So now, for each entry in Control and each Element node in those rows, you get one row of data In that row, you can now pick out those rows where the ElementGU value corresponds to the value you passed in, and for those XML nodes where this is the case, you then select the value of the Label attribute.
You need to approach this a bit differently: since you have a list of nodes, I would suggest you create a list of nodes and then pick the right one from that list - something like this: SELECT AED.Element. Value('(@Label)1', 'varchar(100)') as ControlLabel FROM Control CROSS APPLY Control_XML. Nodes('/AEDControl/Elements/Element') AS AED(Element) WHERE AED.Element.
Value('(@ElementGU)1', 'uniqueidentifier') = @SelectedValueGU I don't know how you want to select from your base table - whether you want to have a WHERE clause or something - but the CROSS APPLY basically takes the XML field and creates a "pseudo-table" called AED. Element from the nodes given in the XPath expression, and cross-applies those to the base table. So now, for each entry in Control and each node in those rows, you get one row of data.In that row, you can now pick out those rows where the @ElementGU value corresponds to the value you passed in, and for those XML nodes where this is the case, you then select the value of the @Label attribute.
I think this XPath (with sql:variable() extension function) should work: /AEDControl /Elements /Element@ElementGU = sql:variable("@SelectedValueGU") /@Label.
In addition, the limitations of the SQL language in handling semi-structured or markup information resulted in the development of the XQuery language. The XQuery language has been designed from scratch taking into consideration the nature of XML data and the issues involved in processing it. SQL Server 2005 has built-in support for the native storage of XML data using the XML data type.
XQuery 1.0 is a language that is being defined by the World Wide Web Consortium (W3C) XML Query Working Group to formulate queries over XML data. XQuery, like SQL, is a declarative query language that, as we will see later, can be easily understood with a basic knowledge of SQL and XPath. This paper is based on the implementation of XQuery 1.0 in SQL Server 2005, which in turn is based on the XQuery 1.0 July 2004 working draft.
The first section of this paper provides an overview of the new XML data type and its associated features. Subsequent sections introduce the new XQuery language and its advantages, the FLWOR statement, various operators in XQuery, built-in functions in XQuery, type-related expressions, and non-supported features in SQL Server 2005, respectively. Finally, the last sections provide information on best practices and guidelines, XML data modification, and XQuery usage scenarios.
The new XML data type introduced in SQL Server 2005 provides users with the ability to store XML documents and fragments in the database. An XML data type can be used to create a column, a parameter to a stored procedure or function, or a variable. Additionally, the user can associate a column of type XML with an XML schema collection to create a typed XML column.
The XML schemas in the collection are used to validate and type the XML instances.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.