Error in X-Path Query

  •  

    I am new to XML in SQL Server and X-Path Query

    Recently I have done the following virtual lab in techNet site

    SQL Server 2005 XML Capabilities

    The following query is worked fine in the lab

    SELECT TOP 10 Demographics.query('declare default element namespace=

    "http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/IndividualSurvey"

    /IndividualSurvey/YearlyIncome')

    FROM Sales.Individual

    But later I installed SQL Server Express in my system and also the Express Manager CTP

    but i am getting the following error if I execute the above query in my system

    Msg 9317, Level 16, State 1, Line 1

    XQuery [Sales.Individual.Demographics.query()]: Syntax error near '=', expected string literal.

  • To declare default namespace, there is no "=" after namespace keyword. And there is a ";" after the namespace string. The following query works:

    SELECT

    TOP 10 Demographics.query('declare default element namespace "http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/IndividualSurvey";

    /IndividualSurvey/YearlyIncome'

    )

    FROM

    Sales.Individual

     

  • Thank you for your information

    but how comes the wrong query(which i posted) working in virtual lab is it due to the bata product.

  • Yes, I think so. I remember some xquery syntax was changed from beta to RTM

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply