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

前端 未结 10 1965
悲哀的现实
悲哀的现实 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:28

    DECLARE @v XML = (SELECT * FROM  FOR XML AUTO)
    

    Insert the above statement at the point where you want to view the table's contents. The table's contents will be rendered as XML in the locals window, or you can add @v to the watches window.

    enter image description here

提交回复
热议问题