functions and procedures

Posted by Sanhtech under Sql Server on 6/18/2013 | Points: 10 | Views : 641 | Status : [Member] | Replies : 4
What is possible of following?
1.functions in procedure?
2.procedure call in function?




Responses

Posted by: Allemahesh on: 6/18/2013 [Member] [MVP] Silver | Points: 25

Up
0
Down
1. Functions in procedure:- Yes this is possible. You can call the functions in your store procedures. You will call functions like normal select statement. E.g.: select * from function_name.
2. Procedure call in function:- No, this is wrong. You can not call procedure in your functions.

Hope this will clear your idea. Happy coding.

Sanhtech, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sanhtech on: 6/18/2013 [Member] Starter | Points: 25

Up
0
Down
why it is possible in procedure and not in functions?

Sanhtech, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Allemahesh on: 6/20/2013 [Member] [MVP] Silver | Points: 25

Up
0
Down
No Idea. You can search on google for this.

Sanhtech, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Learningtorise on: 6/20/2013 [Member] Starter | Points: 25

Up
0
Down
>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

This is how SQL Server behaves for good reasons

http://hashtagakash.wordpress.com/

Sanhtech, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response