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

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

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?

ここに画像の説明を入力してください

ベストアンサー1

DECLARE @v XML = (SELECT * FROM <tablename> 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.

ここに画像の説明を入力してください

おすすめ記事