下面是我的查询,我正在寻找只有子字符串值(将是 YYYY)小于当前年份的记录 - 25 年......我应该提到这个字段是 varchar 并且可能需要转换哪个我也未能成功。
SELECT
AccountNumber,
LoanPrimeLongName,
convert (varchar,LoanOpenDate,103)LoanOpenDate,
LoanOriginalBalance,
LoanBalance,
LoanInterestRate,
LoanRemainingTermMonths,
LoanDelqDays,
LoanDescription
FROM
ARCU.ARCULoanDetailed
WHERE
(((LOANTYPE = '15' OR
LOANTYPE = '16' OR
LoanType = '17') AND
LoanStatus = 'Open') AND
ProcessDate = (CONVERT(VARCHAR, GETDATE(), 112)-1)) AND
(SUBSTRING (loandescription,1,4) not like '%[^0-9]%')
ORDER BY AccountNumber