本文介绍了在sql中使用merge语句的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 大家好, 我在sql studio 2008中使用merge语句并收到错误。请建议我使用merge。 SELECT * FROM BAPU2 MERGE 进入 bapu1 AS b1 使用(选择 ID,VALUE 来自 bapu2) AS b2 on b1.id = b2.id 当 匹配 然后 update set b1.value = b2.value 当 不 匹配 然后 insert values (b1。 ID,b2.name ,b3.value) 错误: 消息156,等级15,状态1,行1 关键字''into''附近的语法不正确。 Msg 156,Level 15,State 1,Line 2 关键字''AS'附近的语法不正确。解决方案 请尝试以下方法, http://blog.sqlauthority.com/2008/08/28/ sql-server-2008-introduction-to-merge-statement-one-statement-for-insert-update-delete / [ ^ ] http://www.cs。 utexas.edu/~cannata/dbms/SQ L%20Merge.html [ ^ ] Hello every one,Iam using merge statement in sql studio 2008 and getting an error. please suggest me to use merge.SELECT *FROM BAPU2MERGE into bapu1 AS b1using (select ID,VALUE from bapu2) AS b2on b1.id = b2.idwhen matched then updateset b1.value=b2.valuewhen not matched then insertvalues(b1.id,b2.name,b3.value)Error:Msg 156, Level 15, State 1, Line 1Incorrect syntax near the keyword ''into''.Msg 156, Level 15, State 1, Line 2Incorrect syntax near the keyword ''AS''. 解决方案 Hi,Try the following,http://blog.sqlauthority.com/2008/08/28/sql-server-2008-introduction-to-merge-statement-one-statement-for-insert-update-delete/[^]http://www.cs.utexas.edu/~cannata/dbms/SQL%20Merge.html[^] 这篇关于在sql中使用merge语句的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
07-22 08:00