I'm having difficult getting an update query to work. What I'm doing is search a table with filenames against another table that has filename wildcards that search against the filenames--if a match is found then it updates the status of the files.
Code is below; let me know if I can clarify anything for you.
Thanks,
Zach
Expand|Select|Wrap|Line Numbers
- UPDATE ed_tblFiles
- SET CurrentStep = CASE RIGHT(fu.OriginalFileName,3)
- WHEN 'pgp' THEN 'PUNENCRYPT'
- ELSE 'UNENCRYPT'
- FROM ed_tblFiles fu
- WHERE fu.FileID IN(
- SELECT f.FileID
- FROM ed_tblFiles f
- INNER JOIN ed_tblPayorsMain p ON f.PayorID = p.PayorID
- INNER JOIN ed_tblPayorsFileNameHandling fnh ON fnh.PayorID = p.PayorID
- WHERE f.OriginalFileName LIKE fnh.FileNamePart + '%' AND
- fnh.FileAction = 'PROCESS' AND f.CurrentStep = 'PCLSFLNAME')
Msg 156, Level 15, State 1, Procedure ed_proClassifyFiles, Line 17
Incorrect syntax near the keyword 'FROM'.
I've also tried the code without using a FROM clause as well.