2013年6月26日 星期三
2013年5月21日 星期二
User Defined Functions
Functions are programmable objects that are used to perform calculations that can be returned to a calling application or integrated into a result set. Functions can access data and return results, but they cannot make any modifications.
You can create your own functions, referred to as user-defined functions, and store the functions in any database for which you have CREATE FUNCTION authority.
2013年5月16日 星期四
Trigger
TRIGGER 是一種特殊的預存程序,雖然也是由使用者自訂的可程式化物件,但是它不可以直接被使用者執行。 它必須建構在 table 或 view 的特定事件中,如:INSERT, UPDATE, DELETE。 當這些事件發生時,才會自動引發 TRIGGER 執行。
Cursor
SQL Server is built to process sets of data. However, there are times when you need to process data one row at a time. The result of a SELECT statement is returned to a server-side object called a cursor, which allows you to access one row at a time within the result set and even allows scrolling forward as well as backward through the result set.
Stored Procedures
The first time that a stored procedure is accessed, SQL Server generates compile and execution plans that are stored in the query cache and reused for subsequent executions. Therefore, you can receive a slight performance benefit when using a stored procedure by avoiding the need to parse, compile, and generate a query plan on subsequent executions of a stored procedure.