![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
SQL Server 2000 SP4. Running the script below prints 'Unexpected': ----------------------------- DECLARE @String AS varchar(1) SELECT @String = 'z' IF @String LIKE '[' + CHAR(32) + '-' + CHAR(255) + ']' PRINT 'Expected' ELSE PRINT 'Unexpected' ----------------------------- If the @String variable is set to 'y' (or in fact any ANSI character other than 'z'), the result is 'Expected'. The comparison also evaluates as expected if CHAR(255) is replaced with CHAR(254). The server collation, if that matters, is SQL_Latin1_General_CP1_CI_AS. It would be helpful to find the explanatin of this behavior. Thanks. |
#3
| |||
| |||
|
|
SQL Server 2000 SP4. Running the script below prints 'Unexpected': ----------------------------- DECLARE @String AS varchar(1) SELECT @String = 'z' IF @String LIKE '[' + CHAR(32) + '-' + CHAR(255) + ']' PRINT 'Expected' ELSE PRINT 'Unexpected' ----------------------------- If the @String variable is set to 'y' (or in fact any ANSI character other than 'z'), the result is 'Expected'. The comparison also evaluates as expected if CHAR(255) is replaced with CHAR(254). The server collation, if that matters, is SQL_Latin1_General_CP1_CI_AS. It would be helpful to find the explanatin of this behavior. Thanks. |
![]() |
| Thread Tools | |
| Display Modes | |
| |