create User Defined Type table

Professionaluser
Posted by Professionaluser under Sql Server category on | Points: 40 | Views : 941
To create user defined type (UDT) in SQL server, use below code...

Sample code is,

IF EXISTS (SELECT * FROM sys.types WHERE name = N'udtTblContentID' )
DROP TYPE [dbo].[udtTblContentID]
GO

CREATE TYPE [dbo].[udtTblStudentID] AS TABLE (
[StudentID] [bigint] NULL
)
GO



We can use the above created UDT as a data type to pass a table/resultset as input to any of the stored procedure/functions in SQL Server

Comments or Responses

Login to post response