1

I'm trying to "convert" this MYSQL query to SQL Server.

update folder_t  a, folder_t  b 
set a.datum_publikace=b.datum_publikace,
    a.datum_expirace=b.datum_expirace,a.nazev=b.nazev 
where a.link=b.idecko and b.linkTyp=0 and a.sekce=20

The current error I am getting:

Incorrect syntax near 'a'.

It is obvious the problem lies in the syntax but really can not find the answer anywhere.

I am a novice when it comes to SQL Server.

If anyone can help out I would really appreciate it.

1 Answer 1

3

SQL Server UPDATE syntax:

UPDATE a
SET a.datum_publikace = b.datum_publikace,
    a.datum_expirace  = b.datum_expirace,
    a.nazev           = b.nazev 
FROM folder_t a
JOIN folder_t b 
  ON a.link = b.idecko
WHERE b.linkTyp = 0 
  AND a.sekce = 20;
Sign up to request clarification or add additional context in comments.

1 Comment

Thank you very much, it helped a lot

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.