We are trying to migrate to SQL Server 2014. There are several cases where we need to use OpenQuery for returning dynamic results. Result Sets will be different according to different input parameters. It was working in sql 2008R2 and I need to keep it working But there is the following error which I can not resolve.
The metadata could not be determined because statement 'EXEC (@sQry)' in procedure 'spTest' contains dynamic SQL. Consider using the WITH RESULT SETS clause to explicitly describe the result set.
I have tried With Result sets undefined but there is still the same error.
SELECT * INTO tblTest
FROM OPENQUERY(LinkedServer, 'SET FMTONLY OFF EXEC spTest ''27'', null, null, null, ''%, Employed'' WITH RESULT SETS UNDEFINED')
Is there any alternatives or work around this.
Thank you in advance.