Click here to Skip to main content
15,891,905 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am using following query for updating records in a table with other table.

SQL
MERGE Tarantulla_Whole_dump_BTS_testing AS T

	USING (

		SELECT AnchorShareRequestRef,effective_btstype,Org_effective_btstype FROM Temp_FinalBTS_till_March2012_testing

		) AS S

		ON ( T.AnchorShareRequestRef = S.AnchorShareRequestRef )				

	WHEN MATCHED
		THEN
			UPDATE
			 SET T.effective_btstype = S.effective_btstype, 
          T.effective_btstype_CSV = S.Org_effective_btstype;


But its showing error when i execute it.

C#
Msg 156, Level 15, State 1, Line 2
Incorrect syntax near the keyword 'AS'.
Msg 156, Level 15, State 1, Line 8
Incorrect syntax near the keyword 'AS'.


I only want to update records not insert or delete using merge.
Posted
Updated 2-Feb-16 22:12pm
v2
Comments
Tomas Takac 3-Feb-16 5:10am    
Are you sure? I'm getting no such error message. SQL Fiddle[^]
Rahul_Pandit 29-Mar-16 2:44am    
This is happening because of security level by our DBA Team.

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