我执行下面的存储过程.但它显示错误.错误是
”.’附近的语法不正确.即错误显示在’xmlFields.Country’中
请查看此存储过程并提前帮助我
create procedure sp_SuUpdateSUADUsersStatus
(
@FinalEMPCode nvarchar(50),
@xmlFields NTEXT
)
AS
DECLARE @CityIDReturn INT
SET NOCOUNT ON
BEGIN
DECLARE @hdoc INT
EXEC sp_xml_preparedocument @hdoc OUTPUT, @xmlFields
BEGIN
EXEC @CityIDReturn=sp_SuSaveADUsersLocation @Country=xmlFields.Country,
xmlFields.State,xmlFields.City
FROM OPENXML(@hDoc, 'EmpCode/User', 2) WITH
(Country nvarchar(500),State nvarchar(500),City nvarchar(500))
as xmlFields
where xmlFields.Country <>'' and xmlFields.State <>'' and xmlFields.City
<>'')
END
EXEC sp_xml_removedocument @hdoc
End
最佳答案 你不能这样做@ Country = xmlFields.Country
尝试以下代码
EXEC @CityIDReturn=sp_SuSaveADUsersLocation xmlFields.Country,
xmlFields.State,xmlFields.City
你不能执行这样的程序,如果你想为每个记录执行程序使用sql游标来实现