I want to find the string NULL or NULL surrounded by any characters except when the next letter is O or A (i.e. NULLO and NULLA are ok). I have come up with the below so far, but it doesn’t quite do what I want:
DECLARE @VAR VARCHAR(255)
SET @VAR = 'NULL'
SELECT @VAR WHERE @VAR LIKE '%NULL[^OA]'
I would go for: