I’m trying to convert error messages held in a database table to user-friendly messages in a report.
I want to be able to replace the value in a field based on the literal text within another field.
The current query returns a dataset with three columns FileName, FileContent, CurrentDate:
SELECT
Left(Filename,Len(Filename)-16) as 'FileName',
FileContent,
Right(left(Filename, Len(Filename) - 8), 8) as 'CurrentDate'
FROM ErrorLogs
WHERE
FileContent like '%Error%'
AND Right(left(Filename, Len(Filename) - 8), 8) =
Replace(convert(varchar(10), getdate(), 102), '.', '')
ORDER BY
filename asc
For example if the file name is ExportFile, I want FileContent to read There was an error with the export file and if the file name is ImportFile I want FileContent to read accordingly.
Thank you in advance for your response…
You do not need temp tables to do this.