Link to home
Start Free TrialLog in
Avatar of Calyx Teren
Calyx TerenFlag for United States of America

asked on

Debug "Incorrect syntax near 'FileType'Col"

The first section works fine, but after that, I get an error in this section below. The equals sign looks like it's highlighted. I need to add many more SET statements. How do i avoid the error?

set [FileTypeCol] = 'File Type2'

use [database]

update table
set [FileTypeCol] = 'File Type1'
from table
where [FileTitle] like '%FileType1%'
   or [Content Title] like '%file-type1%'
   or [Content Title] like '%file Type 1%'
   or [Content Title] like '%File_Type1%'

set [FileTypeCol] = 'File Type2'
from table
where [FileTitle] like '%filetyp2%'
   or [Content Title] like '%file_type2%'

set [FileType] = 'File Type 3'
from table
where [FileTypeCol] like '%filetype3%'
   or [Content Title] like '%FileType3%'

Open in new window

Avatar of Jim Horn
Jim Horn
Flag of United States of America image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Even line 1 is missing the UPDATE TABLE. There is no such thing as a set command for fields, you can only set variables like this, SET field=value always is the clause of an SQL-UPDATE first specifying the table to update.

Bye, Olaf.
>Debug "Incorrect syntax near 'FileType'Col"
>How do i avoid the error?
Also in the future when you copy-paste a code block where the error occured, tell us the line number of the error, making sure that it translates to the EE code block numbers.
Avatar of Calyx Teren


I believe there was a copy-paste error when the admin added my code to the code block. My original code goes from line 3 to line 21. That said, thank you for the feedback. Lots of helpful information. Jim, the code worked after I made the changes you recommended. Thanks!
Thanks for the grade.  Good luck with your code.  -Jim