Monday, December 5, 2011

3 Function

SQL Server has 3 types of User defined functions

  • Scalar functions
  • Inline table-valued functions
  • Multistatement table-valued functions

Friday, December 2, 2011

3 Something about View


View is the virtual table which is defined by the query.

  1. CREATE VIEW vHRdepartment
  2. AS
  3. SELECT  DepartmentID,Name,GroupName,ModifiedDate
  4. FROM HumanResources.Department
  5. WHERE DepartmentID >10


The select statement can not include ODER BY clause, unless we specify the TOP or FOR XML. otherwise the CREATE VIEW will fail with

Msg 1033, Level 15, State 1, Procedure vHRdepartment, Line 6
The ORDER BY clause is invalid in views, inline functions, derived tables, subqueries, and common table expressions, unless TOP or FOR XML is also specified.


SQL Panda Copyright © 2011 - |- Template created by O Pregador - |- Powered by Blogger Templates