Sql Server Interview Question: What function can you NOT call from inside a stored procedure or a user defined function (table or scalar)
In a recent interview I was asked to name a built-in function(s) that cannot be called from inside a stored proced开发者_Go百科ure or a user defined function (both scalar and table-value). I didn't know the answer to the question and gave the generic "I don't know but I'd love to find out."
It turns out after doing a bit of research that I'm no closer to the answer than when I was asked in the interview and now I'm wondering if it was a trick question.
Is this a trick question or is there a real answer?
Thanks.
My answer would have been the functions that are specific to triggers.
I know that Scalar functions are required to be deterministic (e.g. given an input the same results always come back).This means you may not call any non-deterministic functions like NewID or GetDate.
I'm pretty sure that table valued functions don't have this problem.
I'm also unaware of a Built in function that can't be called from a stored proc. What would be the point of the function be?
Obviously this is aside from Joe Stefanelli's answer.
Agree with Conrad re: deterministric functions. I would have explained my understanding of this and confirmed with the interviewer that the question was indeed asking about both functions and sprocs.
If their truly is an answer and I had to guess...I'd have likely said "any functions that alter server configuration".
精彩评论