I'm new to using functions, and it seems to me that the built-in function is very similar to the view. Am I right?
Also, can I have UPDATE statements inside a function?
After reading many answers here, I would like to note that there is a big difference between the built-in table function and any other kind of function (scalar or multi-line TVF).
The built-in TVF is simply a parameterized view. It can be expanded and optimized as a view. There is no need to materialize anything before “returning the results” or something like that (although, unfortunately, the syntax has it RETURN.
RETURN
The big advantage that I found in the built-in TVF over the view is that it requires forced parameterization, while with the view you should assume that the caller will connect accordingly or restrict the use of the view.
, DW . , , - , . TVF , . .
. / .
: -, , - .
: - ; -
Adam Machanic: , :
SO: / ?
DBA ( )
,
, Eric Z Beard downvote...
( ) udf. "Inline" " , ". ...
: , "inline". , , - VIEW .
, SELECT , . , VIEWs . , SELECT * FROM view1 WHERE x = 10; , X, . , , WHERE - , , select.
, "" , VIEWs.
, . JOINS UNION. , . , , .
, , .
Update , Update, .
Update
, , VIEW .
, , VIEW, , , . , VIEW WHERE.
, , ( "" ). , WHERE, ( !). , , , , , , , . ? , , (, VIEW, ..), IMO - , , , .
(msdn):
, , . , , , , , , , .
"" , , . /, . sql , /.
. , . , , . .
A function performs a task or many tasks. The view receives data through the request. All that comes up in this query is that you are limited too. In the function, I can update, select, create variable tables, delete some data, send email, interact with the CLR environment that I created, etc. The method is more powerful than a low-key look!