Try 'SELECT CHARINDEX('Ref', @document, 5)', you'll see the difference.