(XML) value statement is autom. converted to uppercase!

TSchwabTSchwab Posts: 80
edited April 15, 2010 6:15AM in SQL Prompt Previous Versions
:cry:

When I use an XML variable and try to create a SELECT like this:
SELECT T.C.value('@Test', 'INT') as Test
FROM @XML.nodes('V') T(C)

is changed to this:
SELECT T.C.VALUE('@Test', 'INT') as Test
FROM @XML.nodes('V') T(C)


The keyword value is always converted into (upper case) VALUE and that doesn't work for XML.
It's very anoying... I have to manually change it back to lower case...

Please, help.

Thanks,
Thorsten
Regards,

Thorsten

Comments

  • Anu DAnu D Posts: 876 Silver 3
    Many thanks for your post.

    Can you try the folowing settings:

    1. SQL Prompt 4 --> Options --> Format --> Case --> Reserved Keywords --> change to 'Leave as is'

    2. SQL Prompt 4 --> Options --> Format --> Case --> Build-in functions --> change to 'Leave as is'

    3. SQL Prompt 4 --> Options --> Format --> Case --> Build-in data types --> change to 'Leave as is'

    And than try to replicate the issue and let me know if this fixes the issue.
    Anuradha Deshpande
    Product Support
    Redgate Software Ltd.
    E-mail: support@red-gate.com
  • Hello Anu,

    that does not help at all. :(
    It works for the word'value but all the other keywords are kept in the case i'm typing them in.
    That's not helpful. All other keywords, function and data-types are needed in upper case.

    So i have to keep these settings with uppercase.
    I don't understand why value is changed to upper case. It's not a reserved keyword, or a function or a data-type?

    Sorry, but this solution makes it worse. :cry:

    Thanks.
    Thorsten
    Regards,

    Thorsten
  • Anu DAnu D Posts: 876 Silver 3
    Apologies that the suggestion didn't help.

    Can you send us the complete query so that we can understand the scenario and replicate the issue?
    Anuradha Deshpande
    Product Support
    Redgate Software Ltd.
    E-mail: support@red-gate.com
  • Apologies that the suggestion didn't help.

    Can you send us the complete query so that we can understand the scenario and replicate the issue?

    Here is a sample code:
    DECLARE @XML XML
    
    SET @XML = (SELECT ID
    	              , LastName
    	              , FirstName
                FROM (  SELECT  1 AS ID
                              , 'LastName1' AS LastName
                              , 'FirstName1' AS FirstName
                        UNION
                        SELECT 2 AS ID
                              , 'LastName2' AS LastName
                              , 'FirstName2' AS FirstName
                        UNION
                        SELECT 3 AS ID
                              , 'LastName3' AS LastName
                              , 'FirstName3' AS FirstName) AS NameList
                FOR XML AUTO, TYPE
                )
                
                
    SELECT T.C.VALUE('@ID', 'INT') AS ID
           , T.C.VALUE('@LastName', 'NVARCHAR(100)') AS LastName
           , T.C.VALUE('@FirstName', 'NVARCHAR(100)') AS FirstName
    FROM @XML.nodes('/NameList') T(C)
                
    

    If I execute the code I get the error message:
    Msg 227, Level 15, State 1, Line 21
    "VALUE" is not a valid function, property, or field.
    

    "value" is case sensitive and must be in lower case. SQLPrompt changes the value always to upper case.

    It must look like this:
    SELECT T.C.value('@ID', 'INT') AS ID
           , T.C.value('@LastName', 'NVARCHAR(100)') AS LastName
           , T.C.value('@FirstName', 'NVARCHAR(100)') AS FirstName
    FROM @XML.nodes('/NameList') T(C)
    
    Regards,

    Thorsten
  • mscheunermscheuner Posts: 57
    edited February 24, 2010 4:31AM
    Thorsten,

    I've been pestering Red Gate about this behavior ever since they took over SQL Prompt - without any success, so far :-( Glad to see another user also seems to agree this is an issue that needs to be fixed ASAP.

    See this thread here - an "enhancement request" has already been logged - express your interest in it, then we might get them to finally fix it some day!!

    http://www.red-gate.com/MessageBoard/vi ... php?t=9434
  • Hi,

    you are absolutly right. Escpecially that the problem also occures with the keyword modify... :( :shock:

    I hope redgate will have a solution very soon.
    Regards,

    Thorsten
  • Anu DAnu D Posts: 876 Silver 3
    Apologies for the inconvenience caused by this issue.

    It is logged in our internal tracking system (SP-2914).

    We are working on this and I will update you as soon as it is fixed.

    Many thanks for your patience.
    Anuradha Deshpande
    Product Support
    Redgate Software Ltd.
    E-mail: support@red-gate.com
  • Apologies for the inconvenience caused by this issue.

    It is logged in our internal tracking system (SP-2914).

    We are working on this and I will update you as soon as it is fixed.

    Many thanks for your patience.

    Hi,
    I was wondering if there is a time schedule for this error to be fixed?
    Regards,

    Thorsten
  • MikeyCMikeyC Posts: 249 Bronze 3
    Hopefully you will get a better answer than I did:
    ...has advised me that there will more than likely be no layout requests / bugs fixed with this release.

    The quote is referring to version 5 that they are planning to work on in the next quarter.
  • Gee... that's quite a long time... :shock: I guess I have to switch back to SQL-Prompt 3.9 which does not have this problem. :(
    Regards,

    Thorsten
Sign In or Register to comment.