即使我已经尝试过其他帖子建议的仍然相同的错误,我也会收到此错误,但是当我运行 select 它工作正常...任何帮助将不胜感激
ALTER PROCEDURE UpdateCustomers
@XML AS XML
AS
DECLARE @tempTbl TABLE(
tblID INT ,
Customer_name NVARCHAR(30),
Customer_Code NVARCHAR(10)
)
INSERT INTO @tempTbl(tblID, Customer_name, Customer_Code)
SELECT
Item.element.value('@tblID', 'int'),
Item.element.value('@Customer_name', 'nvarchar(30)'),
Item.element.value('@Customer_Code', 'nvarchar(10)')
FROM
@xml.nodes('/root/item') AS Item(element)
--SELECT * FROM @tempTbl---it runs ok
UPDATE dbo.Customers
SET
dbo.Customers.Customer_name = @tempTbl.Customer_name,
dbo.Customers.Customer_Code = @tempTbl.Customer_Code
from dbo.Customers
inner join @tempTbl
on Customers.tblID =@tempTbl.tblID