6

I am trying to create a stored procedure that accepts XML data as an input parameter but cannot get it to compile. The Code:

CREATE PROCEDURE dbo.idn_UpdateUserApplications
(
    @AppIdList xml,
    @UserID nvarchar(256),
    @ModifiedBy nvarchar(256)
)

AS

BEGIN
    SET NOCOUNT ON

    INSERT INTO userapplication 
                (userid, 
                 modifiedby, 
                 modifiedon,
                 appid) 
    SELECT @UserID as userid, 
           @ModifiedBy As modifiedby, 
           Getdate() as modifiedon,
           paramvalues.id.VALUE('.', 'VARCHAR(20)') AS appid 
    FROM   @AppIdList.NODES('/Applications/id') AS paramvalues(ID)   
END 

The Error: Msg 317, Level 16, State 1, Procedure idn_UpdateUserApplications, Line 13 Table-valued function 'NODES' cannot have a column alias.

1
  • I forgot to mention - this is SQL 2005 so I cannot use table valued parameters - darn !! Commented Jun 21, 2011 at 20:02

1 Answer 1

10

NODES and VALUE needs to be lower case nodes, value.

Sign up to request clarification or add additional context in comments.

1 Comment

That was it - can't believe SQL Server is that lame (and I love SQL Server)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.