Posts

Showing posts from July, 2013

Limitation of the Views in SQL server

Image
SQL SERVER – ORDER BY Does Not Work – Limitation of the Views Part 1 Recently, I was about the limitations of views. I started to make a list and realized that there are many limitations of the views. Let us start with the first well-known limitation. Order By  clause does not work in View.  I agree with all of you  who say that there is no need of using ORDER BY in the View.  ORDER BY should be used outside the View and not in the View. This example is another reason why one should not use ORDER BY in Views. Here is the quick example for the same. I have used sample database AdventureWorks for the example. USE  AdventureWorks GO -- First Run regular query and observe SELECT  * FROM  Sales.SalesOrderDetail ORDER BY  SalesOrderDetailID  DESC GO -- Create view with same T-SQL Script IF  EXISTS ( SELECT  *  FROM  sys.views  WHERE  OBJECT_ID  = OBJECT_ID ( N'[db...