© Lisa Bohm 2020
L. BohmRefactoring Legacy T-SQL for Improved Performancehttps://doi.org/10.1007/978-1-4842-5581-0_4

4. Database Views

Lisa Bohm1 
(1)
Chardon, OH, USA
 
A view is simply a saved select statement. It does have some limitations that can be hacked around, but with views, “just because you can doesn’t mean you should.” A view can be called just like a table, and a view can call other views. The limitations on views are as follows:
  • The select statement has to be the first statement in a view definition with the exception of CTEs.

  • You can’t order data in a view definition unless you use a TOP statement or FOR XML (I’ve seen plenty of SELECT TOP 100% in my day).

  • Views cannot have default column values or constraints.

  • Views cannot call temporary ...

Get Refactoring Legacy T-SQL for Improved Performance: Modern Practices for SQL Server Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.