FunctionX Procedure Line 345
Improper use of the lateral operator "EXECUTE STRING" within a function.
I get the above error when executing a dynamic statement inside a function in SQL Server 2012. Is there a workaround for this? Any tricks?
PS: sproc (stored procedure) is too long for its body to be inserted as-inside the function.
DECLARE @execsql NVARCHAR(2000) Set @execsql = 'INSERT INTO @TABLE1 EXEC SPROC1 ' + @ID_COMPANY + ',' + @ID_COUNTRY exec (@execsql)
Thank you very much in advance.
In addition, I also need to delete the function inside. I know this contradicts the definition of functions, but I wonder if there are any tricks that can be used
source share