Results 1 to 6 of 6

Thread: int(4)

  1. #1
    Join Date
    Jun 2002
    Posts
    63

    Unanswered: int(4)

    Access complains if I try and setup a table with a field

    somefield int(4),

    does access nor support the use of restricting the size of a field?

    Thanks.

  2. #2
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    By definition an integer is a number between -32,768 and 32,768. So no, for integers you can't define a character length.

    You may want to try setting a validation rule BETWEEN 0 AND 9999
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  3. #3
    Join Date
    Jun 2002
    Posts
    63
    Quote Originally Posted by Teddy
    By definition an integer is a number between -32,768 and 32,768. So no, for integers you can't define a character length.

    You may want to try setting a validation rule BETWEEN 0 AND 9999
    BETWEEN is a select function, isn't it? I'm setting up a table not selecting data.

    I know that int is a an integer value from x to y, but in other SQL engines you can restrict the length e.g. MySQL foobar tinyint(1) NOT NULL,

    I hate access

    lol

  4. #4
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    I'm pretty sure between can be used in the validation rule for a field. You can probably get away with using "< 9999" if you need. You can set the validation rule for a given field in the design view for the table.

    In MySQL, tinyint is defined as a bit, much like the "yes/no" datatype in access or the "bit" datatype in MSSQL. You can't have a tinyint longer the 1 bit, that's the definition of a tinyint.

    It's just standard datatype hell...
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  5. #5
    Join Date
    Jun 2002
    Posts
    63
    This is off topic, but tinyint in MySQL, can have -128 to 127

    doesnlt restricting it to tinyint(1) give -9 to 9?

    will look at using between as a validation rule. Am doing this for a stupid coursework, where we don't actually build the system, we just give the DDL, but we have to use the access standards - bleuch. why, i have no idea, lol.

    -edit-

    oh and when using int in DDL in access it sets it to Long Integer for some reason, and not just Integer? weird.

  6. #6
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    Yup, I mis-spoke on the tinyint thing. I was thinking of their funky implementation of the boolean datatype, which is basically tinyint(1).

    Anywho, validation rule should do what you need. You could also manually do your validation at the application level, but that's not nearly as consistant as restricting the actual table.
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •