Results 1 to 3 of 3

Thread: what is wrong with my tables

  1. #1
    Join Date
    Jul 2003
    Posts
    421

    what is wrong with my tables

    Hi all: I run this table an got error

    Column or parameter #4: Cannot specify a column width on data type int.
    why??
    /* test for existence of table; drop it if exists */
    if exists
    (select * from sysobjects where id = object_id(N'[Categories]')
    and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    drop table [Categories]
    GO
    /* This table depends on SITES */

    CREATE TABLE Categories
    (
    CategoryID int IDENTITY(1,1) NOT NULL PRIMARY KEY CLUSTERED,
    SiteID int FOREIGN KEY (SiteID) REFERENCES Sites(SiteID),
    CategoryName VarChar(50) NOT NULL,
    /* Make sure that the sort order is a number 1 - 99. But we can still order
    by Alphabetical in code */
    DefaultSortOrder int(2) NOT NULL CONSTRAINT CK_DefaultSortOrder CHECK
    (DefaultSortOrder LIKE '[1-9]' OR
    DefaultSortOrder LIKE '[1-9][0-9]')
    )
    GO
    ________
    Hawaii Dispensaries
    Last edited by sql; 03-06-2011 at 01:23 AM.

  2. #2
    Join Date
    Nov 2002
    Location
    New Jersey, USA
    Posts
    3,932
    You are declaring defaultsortorder as int(2), use int only.

  3. #3
    Join Date
    Mar 2003
    Location
    Woking, UK
    Posts
    152
    remove (2) in
    ...DefaultSortOrder int(2) NOT ...

    ...DefaultSortOrder int NOT ...
    You Have To Be Happy With What You Have To Be Happy With (KC)

Posting Permissions

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