The difference between a built-in function and a view

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?

+5
source share
9 answers

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.

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 , . .

+15

. / .

: -, , - .

: - ; -

Adam Machanic: , :

SO: / ?

DBA ( )

,

, Eric Z Beard downvote...

( ) udf. "Inline" " , ". ...

+3

: , "inline". , , - VIEW .

, SELECT , . , VIEWs . , SELECT * FROM view1 WHERE x = 10; , X, . , , WHERE - , , select.

, "" , VIEWs.

, . JOINS UNION. , . , , .

+2

, , .

Update , Update, .

+2

, , VIEW .

, , VIEW, , , . , VIEW WHERE.

, , ( "" ). , WHERE, ( !). , , , , , , , . ? , , (, VIEW, ..), IMO - , , , .

+1

(msdn):

, , . , , , , , , , .

+1

"" , , . /, . sql , /.

0

. , . , , . .

0

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!

-1
source

All Articles