Viewing 15 posts - 301 through 315 (of 1,468 total)
You will need to test, but using PATINDEX *might* give you slightly better performance.
SELECT T1.DocumentNo, T2.LongSentence
FROM Table2 T2
INNER JOIN Table1 T1 ON PATINDEX('%' + T1.DocumentNo + '%',...
Since your query is returning no results, it cannot display a yes/no answer.
What you need to do is change it so that it always returns a result
SELECT...
Looks like you are missing a closing quote in the WHEN part of your case statement.
Here's my version, also no recursion, with added alias names for more clarity:
SELECT
start_date, end_date,
full_weeks * 2 +
...
Viewing 15 posts - 301 through 315 (of 1,468 total)