"Sequence Contains No Elements" when formatting a MERGE

a.higginsa.higgins Posts: 90 Bronze 2
edited August 23, 2016 8:15AM in SQL Prompt
When I try to format any SQL query containing a MERGE statement using SQL Prompt 7.3.0.418, I get a popup error stating that "SQL Prompt was unable to complete this operation. Problem areas have been highlighted."

The first character in the query is then shown with red underlining, and the tooltip reads "Sequence contains no elements".

The following code is the MCVE to reproduce:
DECLARE @Table TABLE (x INT,y DATE)

	MERGE @Table AS Target 
	USING 
	  (
		SELECT 1 AS x, '2016-08-18' AS y
		) AS Source
		ON Target.x = Source.x

	WHEN MATCHED 
		AND Target.y != Source.y
	THEN UPDATE 
		SET
			Target.y = Source.y

	WHEN NOT MATCHED BY Target
	THEN INSERT
		 (x,y)
		VALUES (Source.x, Source.y)

	WHEN NOT MATCHED BY Source 
	THEN UPDATE 
		SET Target.y = '1700-01-01'


SELECT * FROM @Table t

Comments

Sign In or Register to comment.