Invalid use of a side-effecting operator EXECUTE STRING within a function
Qn is Why would we ever want to use exec within a function.
U are seeing this page because u are trying to execute a string using exec within a function.
DECLARE @SQLString nvarchar(MAX)
DECLARE @Result int
SELECT @SQLString = 'SELECT MAX('+@FieldName+') from '+@TableName
SELECT @SQL = 'select @res = select count(*) from ' + @table_name;
Something like this is why i started searching for a solution for @table_name
Why its not allowed.
-> Reason 1 - Performance
-> Reason 2 - Trust
Ok Now . Research shows that at the current time UDF's can still EXEC a certain class of Stored Procedure called an Extended Stored Procedure.