How to see the values of a table variable at debug time in T-SQL?

前端 未结 10 1977
悲哀的现实
悲哀的现实 2020-11-29 15:30

Can we see the values (rows and cells) in a table valued variable in SQL Server Management Studio (SSMS) during debug time? If yes, how?

10条回答
  •  情话喂你
    2020-11-29 16:11

    SQL Server Profiler 2014 lists the content of table value parameter. Might work in previous versions too. Enable SP:Starting or RPC:Completed event in Stored Procedures group and TextData column and when you click on entry in log you'll have the insert statements for table variable. You can then copy the text and run in Management Studio.

    Sample output:

    declare @p1 dbo.TableType
    insert into @p1 values(N'A',N'B')
    insert into @p1 values(N'C',N'D')
    
    exec uspWhatever @PARAM=@p1
    

提交回复
热议问题