• Snargables (11/20/2013)


    How can u have the same tablename in sysobjects w/ different id's. It's making one of my processes fail. The difference in the records is the uid. I didnt think this could happen. doesn't happen in sys.objects though

    --this returns two tables and the count = 2 for each

    select name,count(*)

    from dbo.sysobjects

    where xtype='u'

    group by name

    having count(*)>1

    schemaname + tablename are unique, so you can have multiple tables with the same name, but under different schemas.

    when you are running multiple schemas, your scripts must be a bit smarter and take that into consideration

    select MIN(schema_name(object_id)),

    MAX(schema_name(object_id)),

    name

    from sys.tables

    group by name

    having count(*)>1

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!