I get this error even though i have tried what other post suggested still the same error
but when i run select it works OK…
any help would be greatly appreciated
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
Try aliasing the table variable in the UPDATE
e.g.