I'm trying to do the following....
Code:
CREATE TABLE NEW_SAMPLES(
ID INT GENERATED ALWAYS AS IDENTITY(START WITH 1, INCREMENT BY 1),
SAMPLE_TEXT VARCHAR(100),
PRIMARY KEY(ID))
GO
CREATE TABLE MAIN_SAMPLES(
ID INT GENERATED ALWAYS AS IDENTITY(START WITH 1, INCREMENT BY 1),
SAMPLE_TEXT VARCHAR(100),
PRIMARY KEY(ID))
GO
INSERT INTO NEW_SAMPLES (SAMPLE_TEXT) VALUES ('Testing 1,2,3')
GO
MERGE INTO MAIN_SAMPLES MS USING (SELECT ID,SAMPLE_TEXT FROM NEW_SAMPLES) NS ON MS.ID = NS.ID
WHEN MATCHED THEN UPDATE SET SAMPLE_TEXT = NS.SAMPLE_TEXT
WHEN NOT MATCHED THEN INSERT (SAMPLE_TEXT) VALUES (NS.SAMPLE_TEXT)
But I keep getting the following message on the MERGE Statement....
Quote:
<eb1>SQL0104N An unexpected token "MS" was found following "MERGE MAIN_SAMPLES ". Expected tokens may include: "JOIN <joined_table>". SQLSTATE=42601
State:42601,Native:-104,Origin:[IBM][CLI Driver][DB2/NT]</eb1>
|
Can any of you fine folks tell me why I'm getting that message that doesn't even seem to make sense
Thanks In Advance.