Collections:
Deleting a Table That Is Used by a View in SQL Server
What Happens If You Delete a Table That Is Used by a View in SQL Server?
✍: FYIcenter.com
Assuming that you have a table which is used by a view, and you try to delete that table. SQL Server will let you delete the table without any trouble.
But that view will become invalid. The tutorial exercise below shows you what happens to the view, when the underlying table is deleted:
USE FyiCenterData; GO SELECT * INTO fyi_links_copy FROM fyi_links WHERE counts > 0; GO CREATE VIEW fyi_links_view AS SELECT * FROM fyi_links_copy; GO SELECT COUNT(*) FROM fyi_links_view; GO 50015 DROP TABLE fyi_links_copy; GO SELECT COUNT(*) FROM fyi_links_view; GO Msg 208, Level 16, State 1, Line 1 Invalid object name 'fyi_links_copy'. Msg 4413, Level 16, State 1, Line 1 Could not use view or function 'fyi_links_view' because of binding errors.
⇒ Using ORDER BY to Define a View in SQL Server
⇐ Creating a View with Data from Another View in SQL Server
2016-11-04, 2546🔥, 0💬
Popular Posts:
What Are Bitwise Operations in SQL Server Transact-SQL? Bitwise operations are binary operations per...
What is sqlservr.exe - Process - SQL Server (SQLEX?PRESS) in SQL Server? Process sqlservr.exe is the...
How To Start the Command-Line SQL*Plus in Oracle? If you Oracle server or client installed on your w...
How To Select All Columns of All Rows from a Table with a SELECT statement in SQL Server? The simple...
How to download and install the scaled-down database AdventureWorksLT in SQL Server? If you want to ...