Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
shonre89
Starting Member
5 Posts |
Posted - 2014-07-01 : 03:16:14
|
i have two conditions to check for. 1st condition is to check if status is FINISHED then update OK2nd condition is to check if status is LOADING_BY_LINE then update ONGOINGI manage to do it for one but i could not get the syntax right on the if statementUPDATE fSET Inspector_Status = 'OK'FROM FM_SHARE_RO_MOVED fWHERE EXISTS ( SELECT * FROM PARSE_FILE_DETAILS WHERE File_Location LIKE '%' + f.File_name + '%' and STATUS ='FINISHED' )-SHON- |
|
ahmeds08
Aged Yak Warrior
737 Posts |
Posted - 2014-07-01 : 04:55:22
|
can you try thisupdate f set Inspector_Status =case when status='FINISHED' then 'OK'when status='LOADING_BY_LINE' then 'ONGOING'else 'something'Javeed Ahmed |
 |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2014-07-01 : 05:43:01
|
[code]UPDATE fSET f.[Inspector_Status] = CASE x.[Status] WHEN 'FINISHED' THEN 'OK' WHEN 'LOADING_BY_LINE' THEN 'ONGOING' ELSE f.[Inspector_Status] ENDFROM dbo.FM_SHARE_RO_MOVED AS fLEFT JOIN dbo.PARSE_FILE_DETAILS AS x ON x.File_Location LIKE '%' + f.[File_name] + '%';[/code] Microsoft SQL Server MVP, MCT, MCSE, MCSA, MCP, MCITP, MCTS, MCDBA |
 |
|
shonre89
Starting Member
5 Posts |
Posted - 2014-07-07 : 04:25:06
|
THANK YOU VERY MUCH. IT WORKS FINEquote: Originally posted by SwePeso
UPDATE fSET f.[Inspector_Status] = CASE x.[Status] WHEN 'FINISHED' THEN 'OK' WHEN 'LOADING_BY_LINE' THEN 'ONGOING' ELSE f.[Inspector_Status] ENDFROM dbo.FM_SHARE_RO_MOVED AS fLEFT JOIN dbo.PARSE_FILE_DETAILS AS x ON x.File_Location LIKE '%' + f.[File_name] + '%'; Microsoft SQL Server MVP, MCT, MCSE, MCSA, MCP, MCITP, MCTS, MCDBA
-SHON- |
 |
|
|
|
|
|
|