You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
MERGE [testDb].[dbo].[testTbl] AS [target]
USING (VALUES (@key1, @key2, @key1, @key2 ))
AS [source] ([key1], [key2], [key1], [key2])
ON [key1] = @key1 AND [key2] = @key2
WHEN MATCHED THEN
UPDATESET [source].[data1] = [target].[data1] , [source].[data2] = [target].[data2]
WHEN NOT MATCHED BY TARGET
THEN INSERT ([key1], [key2], [data1], [data2]) VALUES ([source].[key1], [source].[key2], [source].[data1], [source].[data2]);
while
MERGE [testDb].[dbo].[testTbl] [target]
USING (VALUES (@key1, @key2, @key1, @key2 ))
AS [source] ([key1], [key2], [key1], [key2])
ON [key1] = @key1 AND [key2] = @key2
WHEN MATCHED THEN
UPDATESET [source].[data1] = [target].[data1] , [source].[data2] = [target].[data2]
WHEN NOT MATCHED BY TARGET
THEN INSERT ([key1], [key2], [data1], [data2]) VALUES ([source].[key1], [source].[key2], [source].[data1], [source].[data2]);
parses correctly.
I'm assuming that the AS isn't expected after the column name of the MERGE while it should be?
The text was updated successfully, but these errors were encountered:
It seems like there are more edge cases in the parsing of a MERGE:
MERGE [testDb]. [dbo]. [testTbl] [target]
USING ( VALUES ( @key1, @key2, @data1, @data2 ))
AS [source] ( [key1], [key2], [data1], [data2])
ON [target]. [key1] = [source]. [key1] , [target]. [key2] = [source]. [key2]
WHEN MATCHED THEN
UPDATESET [target]. [data1] = [source]. [data1] , [target]. [data2] = [source]. [data2]
WHEN NOT MATCHED BY TARGET
THEN INSERT ( [key1], [key2], [data1], [data2]) VALUES ( [source]. [key1], [source]. [key2], [source]. [data1], [source]. [data2]) OUTPUT cast(1asbit) AS RowExists, 1as RowsUpdatedOrInserted, @@ERROR as ErrorCode, [INSERTED]. [key1], [INSERTED]. [key2], [INSERTED]. [data1], [INSERTED]. [data2];
It doesn't seem to like the CAST(1 as bit) AS RowExists, but here it doesn't even parse the implicit alias syntax, so even 1 RowExists doesn't get parsed correctly here.
It just outputs a merge expression and an unknown expression, with CAST being the first token of the unknown expression.
This fails to parse:
while
parses correctly.
I'm assuming that the AS isn't expected after the column name of the MERGE while it should be?
The text was updated successfully, but these errors were encountered: