Home Forums SQL Server 2008 SQL Server 2008 - General SQL Server Collation (ASCII Table sort and Case Insensitive/Accent Insensitive) RE: SQL Server Collation (ASCII Table sort and Case Insensitive/Accent Insensitive)

  • One of the SQL collations should do what you need. This one works for your sample data:

    DECLARE @apples TABLE

    (

    sequence integer NOT NULL,

    apple varchar(6) COLLATE SQL_Latin1_General_CP1_CI_AI NOT NULL

    )

    INSERT @apples

    (sequence, apple)

    VALUES

    (1, '!apple'),

    (2, '-apple'),

    (3, '0apple'),

    (4, '1apple'),

    (5, 'APPLE'),

    (6, 'Apple'),

    (7, 'apple'),

    (8, 'àpple'),

    (9, 'Bpple'),

    (10, 'bpple'),

    (11, 'èpple'),

    (12, 'Zpple'),

    (13, 'zpple')

    SELECT *

    FROM @apples AS a

    ORDER BY apple;

    -- SQL Server Sort Order 54 on Code Page 1252 for non-Unicode Data

    SELECT *

    FROM sys.fn_helpcollations() AS fh

    WHERE fh.name = 'SQL_Latin1_General_CP1_CI_AI';