Execute Immediate from function..
Posted on 2006-11-13
I am trying to execute below code within MSSQL function..
SET @query = @query + ' FROM DBO.' + @sTable + ' WHERE ' + @sTable +'.ComponentId = ' + CONVERT(CHAR, @id);
EXECUTE IMMEDIATE @query;
Getting error as:
Invalid use of 'EXECUTE' within a function.
Please let me know how should i achieve this..
I tried using execute and execute immediate. But its giving error.
Thanks in advance.
~ HNS ~