Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

merge statment error 102

$
0
0

An error message occurred when I run the following code

Merge dbo.individual AS a -- target 
  using (Select id, fname, lname from [dbo].[Staging_table]) AS b -- source 
  on a.id=b.id 
  --when matched then break; 
  when not matched then 
  insert (id, fname,lname) values (b.id,b.fname,b.lname);

The following is the error message

Msg 102, Level 15, State 1, Line 5
Incorrect syntax near 'dbo'.
Msg 156, Level 15, State 1, Line 6
Incorrect syntax near the keyword 'AS'.

I run the select statement alone with no error

please advise


Viewing all articles
Browse latest Browse all 23857

Trending Articles