Is it possible to inspect the contents of a Table Value Parameter via the debugger?

Posted by Stephen Edmonds on Stack Overflow See other posts from Stack Overflow or by Stephen Edmonds
Published on 2010-06-09T10:08:44Z Indexed on 2010/06/09 10:12 UTC
Read the original article Hit count: 134

Does anyone know if it is possible to use the Visual Studio / SQL Server Management Studio debugger to inspect the contents of a Table Value Parameter passed to a stored procedure?

To give a trivial example:

CREATE TYPE [dbo].[ControllerId] AS TABLE(
    [id] [nvarchar](max) NOT NULL
)
GO

CREATE PROCEDURE [dbo].[test]
    @controllerData [dbo].[ControllerId] READONLY
AS
BEGIN
    SELECT COUNT(*) FROM @controllerData;
END

DECLARE @SampleData as [dbo].[ControllerId];
INSERT INTO @SampleData ([id]) VALUES ('test'), ('test2');

exec [dbo].[test] @SampleData;  

Using the above with a break point on the exec statement, I am able to step into the stored procedure without any trouble. The debugger shows that the @controllerData local has a value of '(table)' but I have not found any tool that would allow me to actual view the rows that make up that table.

© Stack Overflow or respective owner

Related posts about debugging

Related posts about sql-server-2008