Search code examples
sqlsql-serverviewrowrecovery

How can I find out which tables are in a view (SQL Server Management Studio)


I just executed the following update statement on a view:

use [SERVER]

update [TABLE]
set USRN = 14201962 
where COLUMN_UID = 4668083

Turns out there was a trigger that deleted that row entirely from the view instead of modifying that specific cell.

How can I get that row back? I'm assuming it might still be in the table that the row is associated with but I do not know what that table is. Is there a way for me to see which tables are part of the view so I can look through each one to try and locate the missing view row? Other suggestions are also welcome.

Thanks


Solution

  • You can right-click the view in SSMS and choose "Script As Create..." and see the query the view uses.