Re: Need pkey data type of 32 < x < 64 bits size.

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Steve Kass (skass_at_drew.edu)
Date: 03/22/04


Date: Mon, 22 Mar 2004 11:27:49 -0500

Jan,

  You've already observed the important difference between character and
binary types. Character types are for words, and trailing spaces don't
matter, case and accents may or may not matter, and bytes that represent
non-printing characters may not be treated conveniently. I think
binary(5) would work out for you, but I've never tried this to see if
there is any down side from implicit conversions that might take place:

declare @b binary(5)
set @b = 0x
while @b < 10 begin
  select @b
  set @b = 1 + @b
end

Steve Kass
Drew University

jan wrote:

>Hi all,
>We have a database with 32 bit object identifiers. As we expect this
>to grow considerably we're worried that we may run out of this
>'address' space, but the obvious alternative of a 64 bit bigint is not
>something I'm comfortable with as these identifiers are pervasive -
>the idea of adding an extra four bytes on to just about every row in
>our database is something I'm very unhappy about; we really expect to
>be scaling very large indeed.
>If I could find something of 40 bits I think that would do us for the
>moment, but I can't find anything suitable. A char(5) is superficially
>okay but the SQL standard method of string comparison, where trailing
>spaces are effectively ignored, might have some unexpected surprises,
>and I'm not sure how to efficiently get the next one up from the
>current one; something which is obviously very easy to do with
>integers.
>I had to experimented with decimal (9, 0) but while this takes five
>bytes, which is good, it will take nine decimal digits at the most,
>which is not so good. I presume this is BCD under the skin.
>I could of course add an extra column, a tinyint, but that puts an
>extra load on the SQL optimiser, and frankly, gives it an extra chance
>to make a mistake (I've had to track down a few bad query plans).
>Any suggestions would be welcome.
>
>By the way what is the difference between binary and varbinary? if
>char and varchar can represent the entire range of Ascii (and I
>thought it did) what it is the point of their binary counterparts?
>
>cheers
>
>jan
>
>



Relevant Pages

  • Re: omannumeral-expansion after number in`-nota
    ... space after character constants. ... matter what the arguments of \abc look like. ... According to chapter 24 of the TeXbook, trailing spaces are ...
    (comp.text.tex)
  • Re: asymptote/hyperbola?
    ... >> I have no interest in refuting anything in this matter. ... He's presenting a character who's talking math. ... the passage I cited does no such thing. ...
    (rec.arts.books)
  • Re: Matter by Iain M Banks
    ... Well, I've just finished second-reading Matter, and... ... what Banks is trying to do is very impressive, ... real to make an emotionally-satisfying difference to his character. ... Her emotional Sursamen/Culture loyalty dilemna seems to have been long ...
    (rec.arts.sf.written)
  • Re: VERITAS- Forum from April
    ... Terry Austin ... History is made at night. ... Character is what you are in the dark. ... Drop by ANYTIME and I bet we can discuss this matter ...
    (rec.arts.sf.written)
  • Re: MS Query Problem
    ... The field is a 20 character text string which represents an industry code, ... access & excel that are a problem. ... It would be a very unusual circumstance to keep trailing spaces. ...
    (microsoft.public.access.queries)