Hi, i've a simple question abuot table-valued parameters (i start from an example on Microsoft site:http://msdn.microsoft.com/en-us/library/bb675163(v=vs.110).aspx )
This is my code:
CREATE PROCEDURE usp_UpdateCategories (@tvpNewCategories dbo.CategoryTableType READONLY) AS BEGIN SET @field='Categories.CategoryName = ec.CategoryName' SET @SQL=' UPDATE dbo.Categories SET ' + @field + ' FROM dbo.Categories INNER JOIN @tvpEditedCategories AS ec ON dbo.Categories.CategoryID = ec.CategoryID;’ EXEC sp_executesql @sql END
This stored not works, because @field variable is not recognized... why? i'd like to use dinamically my column name, is not possible ?
Thanks !