我正在尝试创建一个存储过程,它接受XML数据作为输入参数但无法进行编译。守则:
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
错误: 消息317,级别16,状态1,过程idn_UpdateUserApplications,第13行 表值函数'NODES'不能有列别名。
答案 0 :(得分:7)
NODES
和VALUE
必须为小写nodes
,value
。