Posts

Showing posts from March, 2010

SP, UDF and VIEW

SPs are Databse subroutine used to perform tasks within the database, whether it be to INSERT, UPDATE, DELETE, SELECT, send return values, send output parameters, send e-mail, call command line arguments, encapsulate business logic, enforce data integrity, or any combination thereof. They are compiled when first run, and the query plans are stored and cached by SQL Server's optimizer, and those cached plans are swapped out depending on frequency of usage. View: • To hide the complexity of the underlying database schema, or customize the data and schema for a set of users. • To control access to rows and columns of data. • To aggregate data for performance. UDFS: Set of statements which must return an object considered as function. In general, UDFs can be a serious source of performance issues. Also, UDFs cannot be used for DML operations (INSERT/UPDATE/DELETE), cannot use non-deterministic functions, cannot use dynamic SQL, and cannot have error-handling (e.g. RAISERROR)....