Click here to Skip to main content
15,893,814 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
Hello every one,

Iam using merge statement in sql studio 2008 and getting an error. please suggest me to use merge.

SQL
SELECT *FROM BAPU2
MERGE into bapu1 AS b1
using (select ID,VALUE from bapu2) AS b2
on b1.id = b2.id

when matched then update
set b1.value=b2.value

when not matched then insert

values(b1.id,b2.name,b3.value)





Error:
Msg 156, Level 15, State 1, Line 1
Incorrect syntax near the keyword 'into'.
Msg 156, Level 15, State 1, Line 2
Incorrect syntax near the keyword 'AS'.
Posted
Updated 2-Jan-13 19:25pm
v3

1 solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900