Announcement

Collapse
No announcement yet.

[42000] [Microsoft][SQL Server Native Client 11.0][SQL Server]

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • [42000] [Microsoft][SQL Server Native Client 11.0][SQL Server]


    Ispol'zuyu: - Win 7x64 - MS Sql Server 2012 - Navicat 12.0.17 (64-bit) - Premium. Imeyetsya tablitsa: .….. Tablitsa ne zapolnena dannymi. YA proubyu izmenit' tip polya `id` c `bigint` na `int`. YA poluchayu oshibku. Vopros. Kak izmenit' tip polya?
    Развернуть
    242/5000
    I use:
    - Win 7x64
    - MS Sql Server 2012
    - Navicat 12.0.17 (64-bit) - Premium.

    There is a table:
    Code:
    CREATE TABLE [dbo].[tbl_xx] (
      [id] bigint  NOT NULL,
      [Field] int  NULL,
      CONSTRAINT [PK_tbl_xx] PRIMARY KEY NONCLUSTERED ([id])
    WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = OFF, ALLOW_PAGE_LOCKS = OFF)  
    ON [PRIMARY]
    )  
    ON [PRIMARY]
    GO
    
    ALTER TABLE [dbo].[tbl_xx] SET (LOCK_ESCALATION = TABLE)

    The table is not filled with data.
    I’ll ask you to change the `id` field type from` bigint` to `int`.
    I get an error.

    Question.
    How to change the field type?

  • #2
    Because the CONSTRAINT [PK_tbl_xx] PRIMARY KEY is depended on the id field, you will receive error when changing the field type. Please try the following steps:

    1. Cancel the primary key setting
    2. Save the table
    3. Change id field type to int and then set the primary key setting
    4. Save the table

    Comment

    Working...
    X