Skip to Content.
Sympa Menu

freetds - RE: [freetds] collate and TDS8

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Frediano Ziglio <freddyz77 AT tin.it>
  • To: FreeTDS <freetds AT lists.ibiblio.org>
  • Subject: RE: [freetds] collate and TDS8
  • Date: 06 Dec 2002 22:07:39 +0100

Il ven, 2002-12-06 alle 21:05, Lowden, James K ha scritto:
> Does anyone in our mailing list audience have the following server
> configuration?
>
> * MS SQL Server 2000
> * Unicode collation != 1033 (General Unicode)
> * character set != iso_1
>

collation can be specified for every column...
Our server is configured for latin1/case insensitive, english... so it
seem same of yours...


> If you do and you're interested in this problem, I'd like to compare notes
> with you.
>
> Details follow.
>
...
>
> > The problem is: what data should be passed and in which order ??
> > Collapse data are 5 bytes:
> > - first 2 are windows code (0x409 for english), coded in
> > little endian
>
> That's 1033 decimal, a "locale id" (lcid). Try this:
>
> 1> select langid, lcid, msglangid, cast(name as char(30)) as name from
> syslanguages where langid = @@LANGID
> 2> go
> langid lcid msglangid name
> ------ ----------- --------- ------------------------------
> 0 1033 1033 us_english
>

All this stuff are defined in windows...
10 bit for language (low), other for sublanguage.
English (9) american (1) is 0x409 -> 1033

> > - 2 bytes ???
>
> My next two bytes are always 00 01:
>

Mines are 0d 00 (0xd0 in LE??)...
Full lcid on windows as also sort (bits 19-16) and version (bits 23-20)

> 0020 09 04 00 01 00 11 52 00 65 00 67 00 69 00 6f 00 |......R. e.g.i.o.|
>
> The first byte (zero) might be @@langid.
>

My lang id is 0 but this byte if 0xd0...

> The second byte (one) might be the syscharset.id, cf. "Character sets" and
> "Sort Orders" in Books Online. But take care:
>

Mine is 0... status in syscharsets ???

> 1> select c.id, min(a.id), max(a.id), cast(c.name as char(30)) as name from
> syscharsets c join syscharsets a on a.csid = c.id group by c.id, c.name
> 2> go
> id name
> --- ---- ---- ------------------------------
> 1 50 186 iso_1
> 2 40 61 cp850
> 3 30 34 cp437
> 4 80 98 cp1250
> 5 104 108 cp1251
> 6 112 124 cp1253
> 7 128 130 cp1254
> 8 136 138 cp1255
> 9 144 146 cp1256
> 10 152 160 cp1257
> 12 194 201 cp949
> 13 196 202 cp950
> 14 198 203 cp936
> 15 204 206 cp874
> 109 192 200 cp932
>
> master..syscharsets.id is badly named and denormalized, IOW (also note
> "type" is clearly an encoded value). The table should really be called
> "sysortorders", because the id column identifies a sort order, not a
> character set. The only character set names in that table those listed
> above (whose csid is 0).
>
> > - last byte is id in syscharsets
>
> Not for me, my fifth byte is zero.
>

What's your configuration ??


Perhaps 0 is something like default....

> > Is id fixed (always the sames) ?
>
> Doubtful.
>
> > Can we just pass 0 ?
>
> Perhaps for now.
>
> > SQL server send this type of data during login?
>
> No idea.
>
> Interesting problem.

>From a small look

0080 34 00 00 00 00 e3 08 00 07 05 09 04 d0 00 34 00 |4.......
......4.|
0090 e3 17 00 02 0a 75 00 73 00 5f 00 65 00 6e 00 67 |.....u.s
._.e.n.g|
00a0 00 6c 00 69 00 73 00 68 00 00 ab 68 00 47 16 00 |.l.i.s.h
...h.G..|

My collation (default) is 09 04 d0 00 34... so I'd say yes!
Try your server...

See also collationid in systypes... seem a code of out 2-5 bytes (last
3)

freddy77






Archive powered by MHonArc 2.6.24.

Top of Page