SqlQuantumLeap

Unicode to Code Page mappings in SQL Server

Nov 29th, 2015
508
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- This script relates to the following DBA.StackExchange answer:
  2. -- http://dba.stackexchange.com/questions/76781/converting-a-unicode-value-to-a-non-unicode-value-sql-server/122375#122375
  3.  
  4. -- The full list of Unicode to Code Page mappings can be found at the following location:
  5. -- ftp://ftp.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WindowsBestFit/
  6.  
  7.  
  8. -----------------------------------------------------------------------------
  9. --  SETUP 1 (of 3): CREATE DATABASE
  10. -----------------------------------------------------------------------------
  11.  
  12. IF (DB_ID(N'MappingTestCodePage1252') IS NULL)
  13. BEGIN
  14.   CREATE DATABASE [MappingTestCodePage1252]
  15.     COLLATE Latin1_General_CI_AS;
  16. END;
  17. GO
  18.  
  19. USE [MappingTestCodePage1252];
  20. SELECT CONVERT(INT,
  21.                COLLATIONPROPERTY(CONVERT(NVARCHAR(128),
  22.                                          DATABASEPROPERTYEX(DB_NAME(), 'Collation')
  23.                                         ),
  24.                                  'CodePage'
  25.                                 )
  26.               ) AS [DatabaseCodePage];
  27.  
  28.  
  29. -----------------------------------------------------------------------------
  30. --  SETUP 2 (of 3): CREATE Mappings TABLE
  31. -----------------------------------------------------------------------------
  32. IF (OBJECT_ID(N'dbo.Mappings') IS NULL)
  33. BEGIN
  34.   -- DROP TABLE dbo.Mappings;
  35.   PRINT 'Creating Mappings table...';
  36.   CREATE TABLE dbo.Mappings
  37.   (
  38.     UnicodeCodePoint BINARY(2) NOT NULL PRIMARY KEY,
  39.     CodePage1252Code BINARY(1) NOT NULL
  40.   );
  41.  
  42.   -- The following data was imported from the following URI on 2015-11-27
  43.   -- ftp://ftp.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WindowsBestFit/bestfit1252.txt
  44.  
  45.   PRINT 'Populating table...';
  46.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0000, 0x00);
  47.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0001, 0x01);
  48.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0002, 0x02);
  49.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0003, 0x03);
  50.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0004, 0x04);
  51.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0005, 0x05);
  52.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0006, 0x06);
  53.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0007, 0x07);
  54.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0008, 0x08);
  55.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0009, 0x09);
  56.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x000a, 0x0a);
  57.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x000b, 0x0b);
  58.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x000c, 0x0c);
  59.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x000d, 0x0d);
  60.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x000e, 0x0e);
  61.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x000f, 0x0f);
  62.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0010, 0x10);
  63.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0011, 0x11);
  64.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0012, 0x12);
  65.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0013, 0x13);
  66.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0014, 0x14);
  67.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0015, 0x15);
  68.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0016, 0x16);
  69.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0017, 0x17);
  70.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0018, 0x18);
  71.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0019, 0x19);
  72.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x001a, 0x1a);
  73.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x001b, 0x1b);
  74.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x001c, 0x1c);
  75.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x001d, 0x1d);
  76.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x001e, 0x1e);
  77.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x001f, 0x1f);
  78.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0020, 0x20);
  79.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0021, 0x21);
  80.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0022, 0x22);
  81.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0023, 0x23);
  82.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0024, 0x24);
  83.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0025, 0x25);
  84.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0026, 0x26);
  85.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0027, 0x27);
  86.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0028, 0x28);
  87.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0029, 0x29);
  88.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x002a, 0x2a);
  89.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x002b, 0x2b);
  90.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x002c, 0x2c);
  91.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x002d, 0x2d);
  92.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x002e, 0x2e);
  93.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x002f, 0x2f);
  94.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0030, 0x30);
  95.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0031, 0x31);
  96.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0032, 0x32);
  97.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0033, 0x33);
  98.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0034, 0x34);
  99.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0035, 0x35);
  100.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0036, 0x36);
  101.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0037, 0x37);
  102.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0038, 0x38);
  103.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0039, 0x39);
  104.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x003a, 0x3a);
  105.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x003b, 0x3b);
  106.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x003c, 0x3c);
  107.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x003d, 0x3d);
  108.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x003e, 0x3e);
  109.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x003f, 0x3f);
  110.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0040, 0x40);
  111.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0041, 0x41);
  112.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0042, 0x42);
  113.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0043, 0x43);
  114.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0044, 0x44);
  115.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0045, 0x45);
  116.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0046, 0x46);
  117.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0047, 0x47);
  118.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0048, 0x48);
  119.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0049, 0x49);
  120.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x004a, 0x4a);
  121.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x004b, 0x4b);
  122.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x004c, 0x4c);
  123.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x004d, 0x4d);
  124.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x004e, 0x4e);
  125.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x004f, 0x4f);
  126.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0050, 0x50);
  127.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0051, 0x51);
  128.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0052, 0x52);
  129.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0053, 0x53);
  130.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0054, 0x54);
  131.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0055, 0x55);
  132.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0056, 0x56);
  133.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0057, 0x57);
  134.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0058, 0x58);
  135.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0059, 0x59);
  136.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x005a, 0x5a);
  137.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x005b, 0x5b);
  138.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x005c, 0x5c);
  139.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x005d, 0x5d);
  140.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x005e, 0x5e);
  141.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x005f, 0x5f);
  142.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0060, 0x60);
  143.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0061, 0x61);
  144.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0062, 0x62);
  145.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0063, 0x63);
  146.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0064, 0x64);
  147.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0065, 0x65);
  148.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0066, 0x66);
  149.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0067, 0x67);
  150.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0068, 0x68);
  151.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0069, 0x69);
  152.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x006a, 0x6a);
  153.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x006b, 0x6b);
  154.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x006c, 0x6c);
  155.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x006d, 0x6d);
  156.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x006e, 0x6e);
  157.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x006f, 0x6f);
  158.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0070, 0x70);
  159.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0071, 0x71);
  160.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0072, 0x72);
  161.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0073, 0x73);
  162.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0074, 0x74);
  163.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0075, 0x75);
  164.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0076, 0x76);
  165.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0077, 0x77);
  166.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0078, 0x78);
  167.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0079, 0x79);
  168.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x007a, 0x7a);
  169.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x007b, 0x7b);
  170.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x007c, 0x7c);
  171.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x007d, 0x7d);
  172.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x007e, 0x7e);
  173.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x007f, 0x7f);
  174.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0081, 0x81);
  175.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x008d, 0x8d);
  176.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x008f, 0x8f);
  177.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0090, 0x90);
  178.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x009d, 0x9d);
  179.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x00a0, 0xa0);
  180.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x00a1, 0xa1);
  181.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x00a2, 0xa2);
  182.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x00a3, 0xa3);
  183.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x00a4, 0xa4);
  184.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x00a5, 0xa5);
  185.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x00a6, 0xa6);
  186.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x00a7, 0xa7);
  187.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x00a8, 0xa8);
  188.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x00a9, 0xa9);
  189.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x00aa, 0xaa);
  190.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x00ab, 0xab);
  191.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x00ac, 0xac);
  192.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x00ad, 0xad);
  193.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x00ae, 0xae);
  194.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x00af, 0xaf);
  195.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x00b0, 0xb0);
  196.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x00b1, 0xb1);
  197.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x00b2, 0xb2);
  198.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x00b3, 0xb3);
  199.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x00b4, 0xb4);
  200.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x00b5, 0xb5);
  201.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x00b6, 0xb6);
  202.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x00b7, 0xb7);
  203.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x00b8, 0xb8);
  204.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x00b9, 0xb9);
  205.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x00ba, 0xba);
  206.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x00bb, 0xbb);
  207.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x00bc, 0xbc);
  208.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x00bd, 0xbd);
  209.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x00be, 0xbe);
  210.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x00bf, 0xbf);
  211.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x00c0, 0xc0);
  212.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x00c1, 0xc1);
  213.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x00c2, 0xc2);
  214.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x00c3, 0xc3);
  215.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x00c4, 0xc4);
  216.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x00c5, 0xc5);
  217.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x00c6, 0xc6);
  218.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x00c7, 0xc7);
  219.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x00c8, 0xc8);
  220.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x00c9, 0xc9);
  221.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x00ca, 0xca);
  222.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x00cb, 0xcb);
  223.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x00cc, 0xcc);
  224.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x00cd, 0xcd);
  225.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x00ce, 0xce);
  226.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x00cf, 0xcf);
  227.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x00d0, 0xd0);
  228.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x00d1, 0xd1);
  229.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x00d2, 0xd2);
  230.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x00d3, 0xd3);
  231.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x00d4, 0xd4);
  232.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x00d5, 0xd5);
  233.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x00d6, 0xd6);
  234.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x00d7, 0xd7);
  235.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x00d8, 0xd8);
  236.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x00d9, 0xd9);
  237.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x00da, 0xda);
  238.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x00db, 0xdb);
  239.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x00dc, 0xdc);
  240.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x00dd, 0xdd);
  241.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x00de, 0xde);
  242.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x00df, 0xdf);
  243.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x00e0, 0xe0);
  244.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x00e1, 0xe1);
  245.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x00e2, 0xe2);
  246.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x00e3, 0xe3);
  247.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x00e4, 0xe4);
  248.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x00e5, 0xe5);
  249.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x00e6, 0xe6);
  250.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x00e7, 0xe7);
  251.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x00e8, 0xe8);
  252.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x00e9, 0xe9);
  253.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x00ea, 0xea);
  254.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x00eb, 0xeb);
  255.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x00ec, 0xec);
  256.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x00ed, 0xed);
  257.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x00ee, 0xee);
  258.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x00ef, 0xef);
  259.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x00f0, 0xf0);
  260.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x00f1, 0xf1);
  261.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x00f2, 0xf2);
  262.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x00f3, 0xf3);
  263.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x00f4, 0xf4);
  264.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x00f5, 0xf5);
  265.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x00f6, 0xf6);
  266.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x00f7, 0xf7);
  267.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x00f8, 0xf8);
  268.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x00f9, 0xf9);
  269.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x00fa, 0xfa);
  270.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x00fb, 0xfb);
  271.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x00fc, 0xfc);
  272.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x00fd, 0xfd);
  273.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x00fe, 0xfe);
  274.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x00ff, 0xff);
  275.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0100, 0x41);
  276.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0101, 0x61);
  277.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0102, 0x41);
  278.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0103, 0x61);
  279.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0104, 0x41);
  280.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0105, 0x61);
  281.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0106, 0x43);
  282.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0107, 0x63);
  283.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0108, 0x43);
  284.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0109, 0x63);
  285.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x010a, 0x43);
  286.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x010b, 0x63);
  287.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x010c, 0x43);
  288.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x010d, 0x63);
  289.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x010e, 0x44);
  290.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x010f, 0x64);
  291.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0110, 0xd0);
  292.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0111, 0x64);
  293.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0112, 0x45);
  294.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0113, 0x65);
  295.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0114, 0x45);
  296.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0115, 0x65);
  297.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0116, 0x45);
  298.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0117, 0x65);
  299.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0118, 0x45);
  300.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0119, 0x65);
  301.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x011a, 0x45);
  302.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x011b, 0x65);
  303.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x011c, 0x47);
  304.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x011d, 0x67);
  305.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x011e, 0x47);
  306.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x011f, 0x67);
  307.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0120, 0x47);
  308.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0121, 0x67);
  309.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0122, 0x47);
  310.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0123, 0x67);
  311.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0124, 0x48);
  312.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0125, 0x68);
  313.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0126, 0x48);
  314.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0127, 0x68);
  315.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0128, 0x49);
  316.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0129, 0x69);
  317.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x012a, 0x49);
  318.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x012b, 0x69);
  319.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x012c, 0x49);
  320.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x012d, 0x69);
  321.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x012e, 0x49);
  322.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x012f, 0x69);
  323.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0130, 0x49);
  324.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0131, 0x69);
  325.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0134, 0x4a);
  326.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0135, 0x6a);
  327.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0136, 0x4b);
  328.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0137, 0x6b);
  329.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0139, 0x4c);
  330.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x013a, 0x6c);
  331.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x013b, 0x4c);
  332.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x013c, 0x6c);
  333.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x013d, 0x4c);
  334.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x013e, 0x6c);
  335.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0141, 0x4c);
  336.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0142, 0x6c);
  337.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0143, 0x4e);
  338.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0144, 0x6e);
  339.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0145, 0x4e);
  340.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0146, 0x6e);
  341.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0147, 0x4e);
  342.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0148, 0x6e);
  343.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x014c, 0x4f);
  344.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x014d, 0x6f);
  345.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x014e, 0x4f);
  346.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x014f, 0x6f);
  347.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0150, 0x4f);
  348.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0151, 0x6f);
  349.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0152, 0x8c);
  350.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0153, 0x9c);
  351.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0154, 0x52);
  352.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0155, 0x72);
  353.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0156, 0x52);
  354.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0157, 0x72);
  355.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0158, 0x52);
  356.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0159, 0x72);
  357.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x015a, 0x53);
  358.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x015b, 0x73);
  359.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x015c, 0x53);
  360.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x015d, 0x73);
  361.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x015e, 0x53);
  362.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x015f, 0x73);
  363.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0160, 0x8a);
  364.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0161, 0x9a);
  365.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0162, 0x54);
  366.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0163, 0x74);
  367.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0164, 0x54);
  368.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0165, 0x74);
  369.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0166, 0x54);
  370.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0167, 0x74);
  371.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0168, 0x55);
  372.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0169, 0x75);
  373.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x016a, 0x55);
  374.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x016b, 0x75);
  375.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x016c, 0x55);
  376.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x016d, 0x75);
  377.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x016e, 0x55);
  378.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x016f, 0x75);
  379.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0170, 0x55);
  380.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0171, 0x75);
  381.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0172, 0x55);
  382.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0173, 0x75);
  383.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0174, 0x57);
  384.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0175, 0x77);
  385.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0176, 0x59);
  386.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0177, 0x79);
  387.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0178, 0x9f);
  388.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0179, 0x5a);
  389.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x017a, 0x7a);
  390.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x017b, 0x5a);
  391.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x017c, 0x7a);
  392.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x017d, 0x8e);
  393.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x017e, 0x9e);
  394.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0180, 0x62);
  395.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0189, 0xd0);
  396.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0191, 0x83);
  397.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0192, 0x83);
  398.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0197, 0x49);
  399.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x019a, 0x6c);
  400.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x019f, 0x4f);
  401.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x01a0, 0x4f);
  402.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x01a1, 0x6f);
  403.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x01ab, 0x74);
  404.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x01ae, 0x54);
  405.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x01af, 0x55);
  406.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x01b0, 0x75);
  407.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x01b6, 0x7a);
  408.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x01c0, 0x7c);
  409.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x01c3, 0x21);
  410.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x01cd, 0x41);
  411.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x01ce, 0x61);
  412.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x01cf, 0x49);
  413.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x01d0, 0x69);
  414.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x01d1, 0x4f);
  415.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x01d2, 0x6f);
  416.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x01d3, 0x55);
  417.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x01d4, 0x75);
  418.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x01d5, 0x55);
  419.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x01d6, 0x75);
  420.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x01d7, 0x55);
  421.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x01d8, 0x75);
  422.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x01d9, 0x55);
  423.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x01da, 0x75);
  424.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x01db, 0x55);
  425.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x01dc, 0x75);
  426.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x01de, 0x41);
  427.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x01df, 0x61);
  428.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x01e4, 0x47);
  429.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x01e5, 0x67);
  430.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x01e6, 0x47);
  431.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x01e7, 0x67);
  432.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x01e8, 0x4b);
  433.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x01e9, 0x6b);
  434.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x01ea, 0x4f);
  435.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x01eb, 0x6f);
  436.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x01ec, 0x4f);
  437.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x01ed, 0x6f);
  438.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x01f0, 0x6a);
  439.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0261, 0x67);
  440.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x02b9, 0x27);
  441.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x02ba, 0x22);
  442.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x02bc, 0x27);
  443.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x02c4, 0x5e);
  444.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x02c6, 0x88);
  445.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x02c8, 0x27);
  446.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x02c9, 0xaf);
  447.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x02ca, 0xb4);
  448.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x02cb, 0x60);
  449.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x02cd, 0x5f);
  450.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x02da, 0xb0);
  451.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x02dc, 0x98);
  452.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0300, 0x60);
  453.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0301, 0xb4);
  454.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0302, 0x5e);
  455.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0303, 0x7e);
  456.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0304, 0xaf);
  457.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0305, 0xaf);
  458.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0308, 0xa8);
  459.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x030a, 0xb0);
  460.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x030e, 0x22);
  461.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0327, 0xb8);
  462.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0331, 0x5f);
  463.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0332, 0x5f);
  464.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x037e, 0x3b);
  465.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0393, 0x47);
  466.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0398, 0x54);
  467.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x03a3, 0x53);
  468.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x03a6, 0x46);
  469.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x03a9, 0x4f);
  470.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x03b1, 0x61);
  471.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x03b2, 0xdf);
  472.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x03b4, 0x64);
  473.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x03b5, 0x65);
  474.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x03bc, 0xb5);
  475.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x03c0, 0x70);
  476.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x03c3, 0x73);
  477.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x03c4, 0x74);
  478.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x03c6, 0x66);
  479.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x04bb, 0x68);
  480.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x0589, 0x3a);
  481.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x066a, 0x25);
  482.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2000, 0x20);
  483.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2001, 0x20);
  484.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2002, 0x20);
  485.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2003, 0x20);
  486.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2004, 0x20);
  487.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2005, 0x20);
  488.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2006, 0x20);
  489.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2010, 0x2d);
  490.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2011, 0x2d);
  491.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2013, 0x96);
  492.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2014, 0x97);
  493.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2017, 0x3d);
  494.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2018, 0x91);
  495.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2019, 0x92);
  496.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x201a, 0x82);
  497.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x201c, 0x93);
  498.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x201d, 0x94);
  499.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x201e, 0x84);
  500.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2020, 0x86);
  501.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2021, 0x87);
  502.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2022, 0x95);
  503.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2024, 0xb7);
  504.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2026, 0x85);
  505.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2030, 0x89);
  506.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2032, 0x27);
  507.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2035, 0x60);
  508.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2039, 0x8b);
  509.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x203a, 0x9b);
  510.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2044, 0x2f);
  511.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2070, 0xb0);
  512.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2074, 0x34);
  513.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2075, 0x35);
  514.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2076, 0x36);
  515.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2077, 0x37);
  516.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2078, 0x38);
  517.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x207f, 0x6e);
  518.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2080, 0x30);
  519.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2081, 0x31);
  520.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2082, 0x32);
  521.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2083, 0x33);
  522.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2084, 0x34);
  523.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2085, 0x35);
  524.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2086, 0x36);
  525.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2087, 0x37);
  526.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2088, 0x38);
  527.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2089, 0x39);
  528.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x20ac, 0x80);
  529.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x20a1, 0xa2);
  530.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x20a4, 0xa3);
  531.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x20a7, 0x50);
  532.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2102, 0x43);
  533.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2107, 0x45);
  534.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x210a, 0x67);
  535.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x210b, 0x48);
  536.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x210c, 0x48);
  537.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x210d, 0x48);
  538.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x210e, 0x68);
  539.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2110, 0x49);
  540.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2111, 0x49);
  541.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2112, 0x4c);
  542.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2113, 0x6c);
  543.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2115, 0x4e);
  544.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2118, 0x50);
  545.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2119, 0x50);
  546.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x211a, 0x51);
  547.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x211b, 0x52);
  548.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x211c, 0x52);
  549.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x211d, 0x52);
  550.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2122, 0x99);
  551.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2124, 0x5a);
  552.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2128, 0x5a);
  553.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x212a, 0x4b);
  554.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x212b, 0xc5);
  555.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x212c, 0x42);
  556.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x212d, 0x43);
  557.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x212e, 0x65);
  558.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x212f, 0x65);
  559.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2130, 0x45);
  560.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2131, 0x46);
  561.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2133, 0x4d);
  562.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2134, 0x6f);
  563.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2205, 0xd8);
  564.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2212, 0x2d);
  565.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2213, 0xb1);
  566.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2215, 0x2f);
  567.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2216, 0x5c);
  568.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2217, 0x2a);
  569.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2218, 0xb0);
  570.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2219, 0xb7);
  571.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x221a, 0x76);
  572.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x221e, 0x38);
  573.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2223, 0x7c);
  574.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2229, 0x6e);
  575.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2236, 0x3a);
  576.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x223c, 0x7e);
  577.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2248, 0x98);
  578.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2261, 0x3d);
  579.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2264, 0x3d);
  580.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2265, 0x3d);
  581.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x226a, 0xab);
  582.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x226b, 0xbb);
  583.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x22c5, 0xb7);
  584.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2302, 0xa6);
  585.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2303, 0x5e);
  586.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2310, 0xac);
  587.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2320, 0x28);
  588.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2321, 0x29);
  589.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2329, 0x3c);
  590.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x232a, 0x3e);
  591.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2500, 0x2d);
  592.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2502, 0xa6);
  593.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x250c, 0x2b);
  594.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2510, 0x2b);
  595.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2514, 0x2b);
  596.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2518, 0x2b);
  597.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x251c, 0x2b);
  598.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2524, 0xa6);
  599.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x252c, 0x2d);
  600.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2534, 0x2d);
  601.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x253c, 0x2b);
  602.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2550, 0x2d);
  603.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2551, 0xa6);
  604.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2552, 0x2b);
  605.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2553, 0x2b);
  606.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2554, 0x2b);
  607.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2555, 0x2b);
  608.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2556, 0x2b);
  609.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2557, 0x2b);
  610.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2558, 0x2b);
  611.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2559, 0x2b);
  612.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x255a, 0x2b);
  613.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x255b, 0x2b);
  614.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x255c, 0x2b);
  615.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x255d, 0x2b);
  616.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x255e, 0xa6);
  617.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x255f, 0xa6);
  618.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2560, 0xa6);
  619.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2561, 0xa6);
  620.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2562, 0xa6);
  621.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2563, 0xa6);
  622.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2564, 0x2d);
  623.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2565, 0x2d);
  624.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2566, 0x2d);
  625.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2567, 0x2d);
  626.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2568, 0x2d);
  627.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2569, 0x2d);
  628.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x256a, 0x2b);
  629.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x256b, 0x2b);
  630.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x256c, 0x2b);
  631.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2580, 0xaf);
  632.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2584, 0x5f);
  633.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2588, 0xa6);
  634.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x258c, 0xa6);
  635.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2590, 0xa6);
  636.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2591, 0xa6);
  637.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2592, 0xa6);
  638.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2593, 0xa6);
  639.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x25a0, 0xa6);
  640.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x263c, 0xa4);
  641.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x2758, 0x7c);
  642.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x3000, 0x20);
  643.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x3008, 0x3c);
  644.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x3009, 0x3e);
  645.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x300a, 0xab);
  646.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x300b, 0xbb);
  647.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x301a, 0x5b);
  648.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x301b, 0x5d);
  649.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0x30fb, 0xb7);
  650.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0xff01, 0x21);
  651.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0xff02, 0x22);
  652.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0xff03, 0x23);
  653.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0xff04, 0x24);
  654.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0xff05, 0x25);
  655.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0xff06, 0x26);
  656.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0xff07, 0x27);
  657.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0xff08, 0x28);
  658.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0xff09, 0x29);
  659.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0xff0a, 0x2a);
  660.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0xff0b, 0x2b);
  661.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0xff0c, 0x2c);
  662.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0xff0d, 0x2d);
  663.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0xff0e, 0x2e);
  664.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0xff0f, 0x2f);
  665.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0xff10, 0x30);
  666.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0xff11, 0x31);
  667.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0xff12, 0x32);
  668.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0xff13, 0x33);
  669.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0xff14, 0x34);
  670.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0xff15, 0x35);
  671.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0xff16, 0x36);
  672.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0xff17, 0x37);
  673.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0xff18, 0x38);
  674.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0xff19, 0x39);
  675.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0xff1a, 0x3a);
  676.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0xff1b, 0x3b);
  677.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0xff1c, 0x3c);
  678.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0xff1d, 0x3d);
  679.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0xff1e, 0x3e);
  680.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0xff1f, 0x3f);
  681.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0xff20, 0x40);
  682.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0xff21, 0x41);
  683.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0xff22, 0x42);
  684.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0xff23, 0x43);
  685.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0xff24, 0x44);
  686.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0xff25, 0x45);
  687.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0xff26, 0x46);
  688.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0xff27, 0x47);
  689.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0xff28, 0x48);
  690.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0xff29, 0x49);
  691.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0xff2a, 0x4a);
  692.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0xff2b, 0x4b);
  693.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0xff2c, 0x4c);
  694.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0xff2d, 0x4d);
  695.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0xff2e, 0x4e);
  696.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0xff2f, 0x4f);
  697.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0xff30, 0x50);
  698.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0xff31, 0x51);
  699.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0xff32, 0x52);
  700.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0xff33, 0x53);
  701.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0xff34, 0x54);
  702.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0xff35, 0x55);
  703.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0xff36, 0x56);
  704.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0xff37, 0x57);
  705.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0xff38, 0x58);
  706.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0xff39, 0x59);
  707.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0xff3a, 0x5a);
  708.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0xff3b, 0x5b);
  709.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0xff3c, 0x5c);
  710.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0xff3d, 0x5d);
  711.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0xff3e, 0x5e);
  712.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0xff3f, 0x5f);
  713.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0xff40, 0x60);
  714.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0xff41, 0x61);
  715.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0xff42, 0x62);
  716.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0xff43, 0x63);
  717.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0xff44, 0x64);
  718.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0xff45, 0x65);
  719.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0xff46, 0x66);
  720.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0xff47, 0x67);
  721.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0xff48, 0x68);
  722.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0xff49, 0x69);
  723.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0xff4a, 0x6a);
  724.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0xff4b, 0x6b);
  725.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0xff4c, 0x6c);
  726.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0xff4d, 0x6d);
  727.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0xff4e, 0x6e);
  728.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0xff4f, 0x6f);
  729.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0xff50, 0x70);
  730.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0xff51, 0x71);
  731.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0xff52, 0x72);
  732.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0xff53, 0x73);
  733.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0xff54, 0x74);
  734.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0xff55, 0x75);
  735.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0xff56, 0x76);
  736.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0xff57, 0x77);
  737.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0xff58, 0x78);
  738.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0xff59, 0x79);
  739.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0xff5a, 0x7a);
  740.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0xff5b, 0x7b);
  741.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0xff5c, 0x7c);
  742.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0xff5d, 0x7d);
  743.   INSERT INTO dbo.Mappings (UnicodeCodePoint, CodePage1252Code) VALUES (0xff5e, 0x7e);
  744. END;
  745.  
  746.  
  747. -----------------------------------------------------------------------------
  748. --  SETUP 3 (of 3): CREATE UnicodeCharacters TABLE
  749. -----------------------------------------------------------------------------
  750.  
  751. IF (OBJECT_ID(N'dbo.UnicodeCharacters') IS NULL)
  752. BEGIN
  753.   -- DROP TABLE dbo.UnicodeCharacters;
  754.   PRINT 'Creating UnicodeCharacters table...';
  755.   CREATE TABLE dbo.UnicodeCharacters
  756.   (
  757.     UnicodeCodePointBIN BINARY(2) NOT NULL PRIMARY KEY,
  758.     UnicodeCodePointINT AS (CONVERT(INT, [UnicodeCodePointBIN])),
  759.     UnicodeCharacter AS (NCHAR([UnicodeCodePointBIN])),
  760.  
  761.     CodePage1252CodeBIN BINARY(1) NULL, -- NULL if not mapped for Best Fit
  762.     CodePage1252CodeINT AS (CONVERT(INT, [CodePage1252CodeBIN])),
  763.     CodePage1252Character AS (CHAR([CodePage1252CodeBIN])),
  764.  
  765.     ConvertedCharacter AS (CONVERT(VARCHAR(5), NCHAR([UnicodeCodePointBIN]))),
  766.     ConvertedCharacterCodeINT AS (ASCII(CONVERT(VARCHAR(5), NCHAR([UnicodeCodePointBIN])))),
  767.  
  768.     DoesConvertedCharacterMatchMapping AS (
  769.        CASE
  770.          WHEN [CodePage1252CodeBIN] IS NULL -- not mapped
  771.            THEN NULL
  772.          WHEN ((ASCII(CONVERT(VARCHAR(5), NCHAR([UnicodeCodePointBIN]))))
  773.                 = (CONVERT(INT, [CodePage1252CodeBIN])))
  774.            THEN 'Yes'
  775.          ELSE 'No'
  776.        END),
  777.     DoesUnmappedCodePointConvertToSomething AS (
  778.        CASE
  779.          WHEN [CodePage1252CodeBIN] IS NOT NULL -- mapped
  780.            THEN NULL
  781.          WHEN [CodePage1252CodeBIN] IS NULL -- not mapped
  782.               AND [UnicodeCodePointBIN] > 0x00FF -- Unicode range
  783.               AND (ASCII(CONVERT(VARCHAR(5), NCHAR([UnicodeCodePointBIN])))) <> 63
  784.            THEN 'Yes'
  785.          ELSE
  786.            'No'
  787.        END)
  788.   );
  789.  
  790.   PRINT 'Populating table with base Unicode characters...';
  791.   INSERT INTO dbo.UnicodeCharacters ([UnicodeCodePointBIN])
  792.     SELECT TOP (65536) CONVERT(BINARY(2), ROW_NUMBER() OVER (ORDER BY (SELECT NULL)) - 1) AS [num]
  793.     FROM   [master].[sys].[columns] sc
  794.     CROSS JOIN [master].[sys].[objects] so;
  795.  
  796.   -- SELECT * FROM dbo.UnicodeCharacters;
  797.  
  798.   PRINT 'Updating table with Unicode to Code Page 1252 mappings...';
  799.   UPDATE tmp
  800.   SET    tmp.CodePage1252CodeBIN = map.CodePage1252Code
  801.   FROM   dbo.UnicodeCharacters tmp
  802.   INNER JOIN dbo.Mappings map
  803.           ON map.UnicodeCodePoint = tmp.UnicodeCodePointBIN
  804.   WHERE   tmp.CodePage1252CodeBIN IS NULL;
  805.  
  806.   -- SELECT * FROM dbo.UnicodeCharacters;
  807.  
  808. END;
  809.  
  810.  
  811.  
  812. -----------------------------------------------------------------------------
  813. --  TEST QUERIES
  814. -----------------------------------------------------------------------------
  815.  
  816. -- Do any mappings not match conversion?
  817. SELECT * FROM dbo.UnicodeCharacters WHERE DoesConvertedCharacterMatchMapping = 'No';
  818.  
  819. -- Do any unmapped Code Points have a conversion?
  820. SELECT * FROM dbo.UnicodeCharacters WHERE DoesUnmappedCodePointConvertToSomething = 'Yes';
  821.  
  822. -- See all Code Points:
  823. SELECT * FROM dbo.UnicodeCharacters;
  824.  
  825. -- See all conversions:
  826. SELECT * FROM dbo.UnicodeCharacters WHERE CodePage1252CodeBIN IS NOT NULL;
RAW Paste Data