Tag Archives: characters

Detect invalid characters in sql

A customer needs to know whether the names of the users contain some invalid characters, like tab characters. This is the code of a function which validates a string in sql: CREATE FUNCTION IsNameValid( @Name NVARCHAR(100) ) RETURNS BIT BEGIN SELECT @Name = RTRIM(ltrim(@Name)) IF(@name IS null) OR (@Name = ”) RETURN 1 DECLARE @len… Read More »