1

I am trying to execute this statement in DB Browser:

UPDATE p SET SourceId = s.Id 
FROM Practice p INNER JOIN Source s ON  p.Source = s.Name

And it is refusing to execute complaining that says:

there is a syntax error near "FROM"

What am I doing incorrectly here?

shA.t
  • 15,880
  • 5
  • 49
  • 104
pthalacker
  • 2,018
  • 3
  • 21
  • 34
  • @Pheonixblade9 How are those answers different from my t-sql – pthalacker Apr 30 '15 at 01:41
  • 2
    [SQLite doesn't support JOINs in UPDATE statements](http://sqlite.org/lang%5Fupdate.html), Use [IN statement](http://stackoverflow.com/a/774300/4519059) ;). – shA.t Apr 30 '15 at 06:44

2 Answers2

-1

you need to replace Source by [Source]

Vasily Ivoyzha
  • 5,507
  • 3
  • 18
  • 31
-1

Source is a keyword in SQL used for MERGE JOINs.

Put brackets around it to force it to be used as a string literal:

UPDATE p 
SET SourceId = s.Id 
FROM Practice p 
INNER JOIN [Source] s 
ON p.[Source] = s.[Name]
Codeman
  • 11,807
  • 9
  • 49
  • 90