Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 can't call EXEC in function

Author  Topic 

Hani
Starting Member

3 Posts

Posted - 2008-12-07 : 06:18:54
Please I am having an error
Incorrect syntax near 'INSERT @t SELECT id,result FROM @name'
When I am writing :

CREATE Function [dbo].[testString](@name NVARCHAR(20))
RETURNS @t TABLE
(id int ,res int)
AS
BEGIN
EXEC('INSERT @t SELECT id,result FROM '+ @name)
RETURN
END

So please how can i make this function works to be such dynamic because i have more complex issues than this, but i wrote this simple one as an explanation.
Thank you very much......

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-12-07 : 07:47:15
duplicate

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=115805
Go to Top of Page
   

- Advertisement -