StepUp
StepUp

Reputation: 38199

Value of User Defined Table type in stored procedure while debugging in Visual Studio

I am trying to debug stored procedure through Visual Studio 2015 and would like to see value of User Defined Table type.

Script of User Defined Table Type:

CREATE TYPE [dbo].[tp_CommercialActCarSends] AS TABLE(
    [ID] [int] NOT NULL,
    [ArriveDate] VARCHAR(25) NULL,
    [id_Person] [int] NULL,
    [CalcWeight] [DECIMAL](18,3) NULL   
)
GO

And code of stored procedure:

CREATE PROCEDURE [dbo].[MyStoredProcedure](
    , @CommercialActCarSends        tp_CommercialActCarSends READONLY
        , @UserID                       INT = NULL
)
AS
...

I populate ‘DataTable’ object ‘comActsDataTable’ with some data and pass the ‘comActsDataTable’ to the stored procedure through C#:

var reqRes = db.Database.SqlQuery<dynamic>("EXEC dbo.MyStoredProcedure @UserID = @UserID, 
    @CommercialActCarSends = @CommercialActCarSends"
    , InitSqlParameter("@UserID", SqlDbType.Int, usrid)
    , InitSqlParameter("@CommercialActCarSends", SqlDbType.Structured, comActsDataTable, 
    "tp_CommercialActCarSends")

What I see in Visual Studio is just:

enter image description here

Is it possible to see what values of tp_CommercialActCarSends stored procedure received while debugging in Visual Studio?

Upvotes: 0

Views: 801

Answers (1)

Sean Lange
Sean Lange

Reputation: 33581

It would be the same contents as your DataTable. But if you really want to see the contents you would probably need to create a table and insert into that table in your procedure code. Then when it finishes the procedure you could examine the contents of that table. AFAIK you cannot view the actual contents of the parameter value in dotnet when you have a table valued parameter.

Upvotes: 1

Related Questions