I have created a temporary @table and while inserting ,i am using dynamic sql.But this is not getting executed and throws an error that
"EXECUTE cannot be used as a source when inserting into a table variable"
i am using SQLServer2005.
Dont know where i am going wrong
DECLARE @SqlQuery NVARCHAR(4000); SELECT @SqlQuery='SELECT TOP '+CAST(@no_of_rows as CHAR)+'tblEmployee.id , tblProject.ID, 0, 0 FROM tblBilling (NOLOCK) ' INSERT @table EXEC @SqlQuery