Can't drop a index cluster

  • I all,

    I got this table

    -----

    CREATE TABLE [dbo].[Logs](

    [IDLog] [int] IDENTITY(1,1) NOT NULL,

    [IDlogGiorno] [int] NOT NULL,

    [Date_Time] [datetime] NOT NULL,

    [c-Ip] [varchar](20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,

    [cs-Uri-Stem] [varchar](150) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,

    [cs-Uri-Query] [varchar](250) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,

    [cs-Cookie] [varchar](1000) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,

    [cs-Refer] [varchar](500) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,

    CONSTRAINT [Logs_pk] PRIMARY KEY CLUSTERED

    (

    [IDLog] ASC

    )WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]

    ) ON [PRIMARY]

    I try to destroy the clustered index bau alway hanve an error:

    Someone can help me. It isn't a empy table.

    -- the err:

    An explicit DROP INDEX is not allowed on index 'dbo.Logs.Logs_pk'. It is being used for PRIMARY KEY constraint enforcement. (.Net SqlClient Data Provider)

  • Alen cappelletti (2/21/2008)


    I all,

    I got this table

    -----

    CREATE TABLE [dbo].[Logs](

    [IDLog] [int] IDENTITY(1,1) NOT NULL,

    [IDlogGiorno] [int] NOT NULL,

    [Date_Time] [datetime] NOT NULL,

    [c-Ip] [varchar](20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,

    [cs-Uri-Stem] [varchar](150) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,

    [cs-Uri-Query] [varchar](250) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,

    [cs-Cookie] [varchar](1000) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,

    [cs-Refer] [varchar](500) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,

    CONSTRAINT [Logs_pk] PRIMARY KEY CLUSTERED

    (

    [IDLog] ASC

    )WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]

    ) ON [PRIMARY]

    I try to destroy the clustered index bau alway hanve an error:

    Someone can help me. It isn't a empy table.

    -- the err:

    An explicit DROP INDEX is not allowed on index 'dbo.Logs.Logs_pk'. It is being used for PRIMARY KEY constraint enforcement. (.Net SqlClient Data Provider)

    Try:

    ALTER TABLE [dbo].[Logs] DROP CONSTRAINT [Logs_pk]

    (PS: you cannot drop an index using DROP INDEX if it has been created in the table as part of the primary key, you need to use alter table)

    Regards,

    Andras


    Andras Belokosztolszki, MCPD, PhD
    GoldenGate Software

  • OK Thank U

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply