User-Defined Table Types

CREATE TYPE [dbo].[PaymentTableType] AS TABLE(
    [Id] [BIGINT] NOT NULL,   
    [Col01] [VARCHAR](12) NULL,           
    [Col02] [DATE] NULL,            
    [Col03] [SMALLMONEY] NULL,        
    [Col04] [VARCHAR](15) NOT NULL           
)

Stored Procedure

 CREATE PROCEDURE [dbo].[uspProcessRecords]
	@tbRecords dbo.PaymentTableType readonly	
 AS
 BEGIN



 END

Code

                Database db = DatabaseFactory.CreateDatabase();
                DbCommand dbCommand = db.GetStoredProcCommand("uspProcessRecords");

                dbCommand.Parameters.Add(new SqlParameter("@tbRecords", dtRecords));

                SqlParameter returnParam = new SqlParameter("@retValue", SqlDbType.Int) { Direction = ParameterDirection.ReturnValue };
                dbCommand.Parameters.Add(returnParam);
                db.ExecuteNonQuery(dbCommand);
Last modified: July 12, 2019

Author

Comments

Write a Reply or Comment