Skip to content

Instantly share code, notes, and snippets.

@slmcmahon
Created September 23, 2014 16:33
Show Gist options
  • Save slmcmahon/594da214a0fc58523204 to your computer and use it in GitHub Desktop.
Save slmcmahon/594da214a0fc58523204 to your computer and use it in GitHub Desktop.
Reports the index of any characters in a string where the ASCII value is greater than 127
declare
@test nvarchar(500),
@idx int,
@c nchar(1)
set @idx = 1
set @test = 'Nå er tiden for alle gode menn til å komme til unnsetning for landet sitt.'
while @idx < LEN(@test)
begin
set @c = SUBSTRING(@test, @idx, 1)
if (ASCII(@c) > 127)
print @c + ': ' + cast(ASCII(@c) as nvarchar(5)) + ' at ' + cast(@idx as varchar(5))
set @idx = @idx + 1
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment