Recently I've come across a sample code given by someone else, it looks like this
SELECT TOP 1 IVSTK_STKID
FROM IVSTK_TBL
WHERE IVSTK_STKID LIKE strPrefix "%"
ORDER BY IVSTK_STKID Desc
What does the '%' mean and what's the use of it? The code was given to me without doing any further explanation and I'm not even sure it's valid.
CodePudding user response:
When used with LIKE
, the %
sign is a wildcard operator.
In this context, it's looking for anything starting with the value of strPrefix