86843

SQL Server Error: XQuery [nodes()]: A node or set of nodes is required for 'nodes()'

<h3>Question</h3>

I was trying to pass my variables into the nodes() and value() methods, but some errors occurred:

DECLARE @path VARCHAR(50) = '/A/B/C', @node VARCHAR(20) = '@name', @result XML =' <A> <B> <C name='nameA'/> </B> <B> <C name='nameB'/> </B> </A> ' SELECT T.c.value('./sql:variable("@node")', 'varchar(50)') FROM @result.nodes('sql:variable("@path")') T(c)

Raises the error:

<blockquote>

XQuery [nodes()]: A node or set of nodes is required for 'nodes()'

</blockquote>

Also, when I use '/A/B/C' to replace @path, the error raised:

<blockquote>

XQuery [value()]: The XQuery syntax '/function()' is not supported.

</blockquote>

My goal is to get a table like:

|Name| |NameA| |NameB| |···|

来源:https://stackoverflow.com/questions/62401972/sql-server-error-xquery-nodes-a-node-or-set-of-nodes-is-required-for-node

Recommend

  • SQL Server Error: XQuery [nodes()]: A node or set of nodes is required for 'nodes()'
  • Tcl + Check file existence
  • Wordpress plugins it asks for FTP Details
  • how to animate two continuous popup windows with jquery mobile?
  • Activate UISearchBar when the controller is loaded
  • Java Hibernate Check MySQL Replication is in sync
  • Static analysis of header inclusion in C++
  • Multiple custom authentication with spring security
  • Preloading webView doesn't work - trying to reduce loading time
  • Pyinstaller GLIBC_2.15 not found
  • When i select a Textfield the keyboard moves over it
  • Jekyll - How do I create pages in the root directory?
  • How to convert days into months using datetime in Python3?
  • Implementation of timeout in LDAP
  • Get name of days between two date in ios?
  • Getting Microsoft Calibri font on Amazon EC2 ubuntu
  • Create an Office365 mailbox from within C# Web API method
  • python selenium scraping tbody
  • Wireshark Display Filter for Unique Source/Destination IP and Protocol
  • Thumbnails for mxml components in Flex
  • Runtime complexity of getting the length of a string in different representations
  • using maven pom while creating jar:test-jar some times it says JAR will be empty - no content was ma
  • PHPMailer return to AJAX
  • JavaScript Regex to Match Boundaries of Words with diacritics
  • Bad automatic Triangulation with Mayavi for coloring a surface known only by its corner
  • How to get rgb from transparent pixel in js
  • Computing the discrete fourier transform of audio data with FFTW
  • customize soft keyboard key preview
  • Using Service Component Runtime
  • How to use FirstOrDefault inside Include
  • PHP Permalinks.. how to change?
  • Write to .csv file with PHP (Commas in Data Error)
  • media foundation H264 decoder not working properly
  • Running R's aov() mixed effects model from Python using rpy2
  • Access to a Matlab gui from the web
  • ReferenceError: TextEncoder is not defined