-1

I know that functions always returns a value and I'll make a sp which return a value as the function returns and want to calling it inside the function. How might I do this?

4

1 回答 1

3

Some thoughts after your comments above

  • Generally stored procedures can do almost anything. So it is safer to disallow them

  • The engine can't reliably work out what your stored procedure does
    What about nesting of stored procedures, or recursion, or linked server calls or OPENQUERY calls, and many many other things

  • What if someone change it later to do some writes?
    You can't schema-bind a UDF to a stored procedure

  • Error throwing/handling is a state change even if the stored procedure is read only

This is how SQL Server behaves for good reasons

于 2012-06-05T07:06:03.567 回答