|
Hi, I'm trying to get the results of a MS SQL query into a manifold table using EXECUTE. This normally works without issue except in this case, the SQL uses a temp table. I understand I need to modify it to use RESULT SETS otherwise I get a SQLSTATE: 42000 error. So, I can get the query to run in Manifold without error, but no results are returned. Here's a simple example using a temp table where results are returned when running the SQL, within the EXECUTE block, in SSMS but not in Manifold. -- $manifold$ SELECT * FROM ( EXECUTE[[ DECLARE @sqlCommand VARCHAR(max); SET QUOTED_IDENTIFIER OFF; SET @sqlCommand = " CREATE TABLE #myTempTable ( ID int, myValue varchar(50) ); INSERT INTO #myTempTable VALUES (1,'row1'), (2,'row2'), (3,'row3'), (4,'row4'); SELECT * FROM #myTempTable "; SET QUOTED_IDENTIFIER ON; EXEC (@sqlCommand) WITH result sets(( id INT ,myValue VARCHAR(max) )); ]] on [my MS SQL Database]);
|