Hi,
For doing this you must create a table type user variable (User defined table type in sql server) . Please note that, the type should be in your data table structure, I mean its type. Means data types of fields man :)
here is the code for create table type in SQL server.
CREATE type dbo.categorytabletype AS TABLE
( categoryid INT, categoryname NVARCHAR(50) )
here categorytabletype Is my table type
categoryid and categoryname Are fields of table type variable followed by its data type
Simply like table creation
let us start to create our procedure with this table type parameter
CREATE PROCEDURE Usp_updatecategories
(@tvpNewCategories dbo.categorytabletype READONLY)
AS
BEGIN
/* CRATE YOUR PROCEDURE BODY HERE */
/* WE CAN ACCESS THE @tvpNewCategories LIKE A TABLE HERE*/
END
Don't forget about READONLY , He is an important one, Table type parameter should be readonly.
Thank you :)
No comments:
Post a Comment