Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

sql server 2012 table-valued parameters

$
0
0

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 !




Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>