Not Monitored
Tag not monitored by Microsoft.
36,112 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hello Microsoft team,
I am using dedicated sql pool with COMPATIBILITY_LEVEL set to 130. CTAS and OPENJSON queries work fine when executed separately. However, something weird happens when I try to run CTAS statement with a SELECT query that uses OPENJSON function. When I run the script below I get the following error: Parse error at line: 4, column: 18: Incorrect syntax near 'AS'. There is nothing wrong with the syntax, but for some mysterious reason the CTAS operation fails. Could you please help me figure out what is going on?
DECLARE @array VARCHAR(MAX);
SET @array = '[{"month":"Jan", "temp":10},{"month":"Feb", "temp":12},{"month":"Mar", "temp":15},
{"month":"Apr", "temp":17},{"month":"May", "temp":23},{"month":"Jun", "temp":27}
]';
CREATE TABLE [dbo].[Months]
WITH (
DISTRIBUTION = ROUND_ROBIN,
HEAP
)
AS
SELECT *
FROM OPENJSON(@array)
WITH (
month VARCHAR(3),
temp int
) as months;
I have the same problem. Create view works though.