0

I defined sql query and it runs with no problem on MySQL (I am using MySQL) , but when I am trying to execute it on client site (they uses SQL Server) I am getting "Error: Incorrect syntax near 'si'." error message

Hope someone can help me to define right syntax.

The query is following:

update stepinstance si
     inner join cesteplink l on si.id = l.stepinstance_id 
     inner join prompt p on si.prompt_id = p.id
set si.principal_id = 29160180  
where l.case_id = 29179541 
  and si.principal_id = 1799409 
  and si.status = 'In Progress'

1 Answer 1

2

set has to be before the join conditions.

update si
set si.principal_id = 29160180 
from stepinstance si
inner join cesteplink l on si.id = l.stepinstance_id 
inner join prompt p on si.prompt_id = p.id 
where l.case_id = 29179541 
and si.principal_id = 1799409 
and si.status = 'In Progress'
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks, it works. I am using Squirrel to run quesrie, and was confused when it complained to "from", I just ignored and run, and it update record

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.