| ||
To | Do This |
---|---|
Create a T-SQL function that does not touch the database | Create a scalar UDF using the CREATE FUNCTION statement with a RETURNS clause. |
Create a T-SQL function that returns the result set of a SQL SELECT statement | Create an in-line UDF using the CREATE FUNCTION statement with a RETURNS TABLE clause. |
Create a T-SQL function that returns a result set involving more than a single SELECT statement that may use parameters and has programming logic | Create a table-valued UDF using the CREATE FUNCTION statement with a RETURNS @tablename TABLE clause. |
Update data using T-SQL | Create a stored procedure using the CREATE PROCEDURE statement. |
Create T-SQL-callable code that is CPU or calculation intensive rather than database intensive | Create a CLR UDF or CLR stored procedure. |
| ||