Object already exists

  • Hi,

    I created test table. I drop that table when I tried to create the table again with same name. It is showing the msg object already exists but I can't see under the table list

  • Check to make sure your schema information is matching. I usually see that happen when I forget to slap dbo. onto the table name in the create. My default schema matches my NT login, and thus isn't defaulted to dbo.


    - Craig Farrell

    Never stop learning, even if it hurts. Ego bruises are practically mandatory as you learn unless you've never risked enough to make a mistake.

    For better assistance in answering your questions[/url] | Forum Netiquette
    For index/tuning help, follow these directions.[/url] |Tally Tables[/url]

    Twitter: @AnyWayDBA

  • Evil Kraig F (8/28/2014)


    Check to make sure your schema information is matching. I usually see that happen when I forget to slap dbo. onto the table name in the create. My default schema matches my NT login, and thus isn't defaulted to dbo.

    Further on Craig's post, you can check for the table existence by querying the sys.tables view

    😎

    SELECT

    T.name AS TABLE_NAME

    ,OBJECT_SCHEMA_NAME(T.object_id) AS TABLE_SCHEMA_NAME

    FROM sys.tables T

    WHERE T.name = N'myTableName';

  • Thank you.

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

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