Check this:
DECLARE @tblScannedFileDetails TABLE(RequestId Bigint, FileType Varchar(155), [FileName] Varchar(155), [Status] VARCHAR(30))
INSERT INTO @tblScannedFileDetails (RequestId, FileType, [FileName], [Status])
VALUES(1, 'DRA', '1_DRA.pdf', 'Available'),
(1, 'DRA Training', NULL, NULL),
(2, 'CRA', '1_CRA.pdf', NULL),
(2, 'CRA', NULL, NULL)
SELECT RequestId, FileType, [FileName], [Status], [NewStatus] = CASE
WHEN (FileType = 'DRA' AND NOT [FileName] IS NULL) OR (FileType = 'DRA Training' AND [FileName] IS NULL) THEN 'Available'
WHEN (FileType = 'DRA' AND [FileName] IS NULL) OR (FileType = 'DRA Training' AND NOT [FileName] IS NULL) THEN 'Available'
WHEN (FileType = 'CRA' AND NOT [FileName] IS NULL) OR (FileType = 'CRA Training' AND NOT [FileName] IS NULL) THEN 'Available'
ELSE 'Not Available' END
FROM @tblScannedFileDetails
Returned values:
RequestId FileType FileName Status NewStatus
1 DRA 1_DRA.pdf Available Available
1 DRA Training NULL NULL Available
2 CRA 1_CRA.pdf NULL Available
2 CRA NULL NULL Not Available
Is that what you're looking for?
If you would like to update table in single statement, check this:
UPDATE from SELECT using SQL Server - Stack Overflow[
^]