How to Fix Inconsistent Metadata Errors

  • Antares686

    SSC Guru

    Points: 125444

    Comments posted to this topic are about the content posted at http://www.sqlservercentral.com/columnists/jtravis/changingcolumn.asp

  • darren.green

    SSChasing Mays

    Points: 641

    Is this not covered by this fix-

    FIX: Error Message 7355 "..Inconsistent metadata for a column" Occurs When You Use a Linked Server (Q306401)

    http://support.microsoft.com/default.aspx?scid=kb;en-us;Q306401

    Darren Green
    SQLDTS.com   |   SQLIS.com   |   Konesans Ltd

  • Antares686

    SSC Guru

    Points: 125444

    Actually no, the server I tested from was (RC, SP1, SP2) on 2000 and (RC, SP1, SP2, SP3) with SQL 7. The problem actually steams form the column order stored in the syscolumns table and not the string lenght compared to the index which was directly related to SQL 2000 and not 7.

    "Don't roll your eyes at me. I will tape them in place." (Teacher on Boston Public)

  • Argyle

    SSC Veteran

    Points: 282

    This is so unbelievably on target. I had this exact same problem and MS had no fix for it. THX!!!

  • Antares686

    SSC Guru

    Points: 125444

    Thank you, and as for an update, when I was doing SP4 beta it looked like the had casually fixed it there with no mention which is not unusual. However, I have not had a chance to verify with the final release code but will in the next week or so.

    "Don't roll your eyes at me. I will tape them in place." (Teacher on Boston Public)

  • rithomas

    Valued Member

    Points: 51

    If you're worried about changing system columns, a quick workaround to query a linked database would be to query against views instead of tables.

  • thotakura

    SSC Journeyman

    Points: 99

    I ran the script given by James Travis to fix the column

    order . It did fix the column order, but the data in the

    table got messed up as the colid and colorder columns are updated in

    the syscolumns table.

    Can anybody explain the reason why the data gets messed up

    as the colid and colorder are updated.

    Any help is appreciated and can email to sridhar_t @hotmail.com

    Thanks

    Sridhar

  • Antares686

    SSC Guru

    Points: 125444

    I am not sure why you had this occur. I tested on several machines to insure that I was messing with the proper fields and had no issues with it in any situation I could come up with. What is visually happening to your data and can you post your table structure as I am curious specifically where this becomes an issue to try and improve it. Also, I hope you made a backup of your data beforehand as I would hate to think you lost anything but I did state I make no guarantees as there is always the unknown factor to think about. If you did you may want to restore and try updating the server to SP4 and see if this fixes (please do on a test server to test), when doing the beta it seemed it has a hushed fix of this problem which probably showed other related situations as well. Also was the version an English version server?

    "Don't roll your eyes at me. I will tape them in place." (Teacher on Boston Public)

  • fastorro

    SSC Veteran

    Points: 250

    NOOOOOOOOOOOOOOOOOOOO!!!

    my data base has been corrupt due to this solution, This solution DOES NOT WORK with SQL server 7 SP3

  • Antares686

    SSC Guru

    Points: 125444

    I do hope you made a backup.

    I did check I still have not had issues so I am wondering what specifically is under the hood that causes this. Can you post your DDL so I can have a look under SQL at what it is doing?

    As seems to not cause further issues in SP4 I did not test any SP4 machines. I will have the code pulled so no one else can potentially even try this.

  • fastorro

    SSC Veteran

    Points: 250

    I was woking in a reply of my real BBDD.

    Thank's...

    i have find the solution running instcat.SQL

    from install dir.

  • dgm

    SSC Journeyman

    Points: 75

    A new twist......

    2 servers running SQL7 SP3 and getting this error from a single table. I've manually check the ordinal numbers - they are identical and sequential... there should be no problem? There is, it still gives Msg 7353...

    I have no explanation, I got round it by locally copying the data I needed into a new table and then querying that.


    dgm

  • crutherfurd

    SSC Veteran

    Points: 286

    I can't thank you enough!!! You saved our production run from being late! I ran this on SQL Server 7 sp 4 and it worked like a charm.

  • ken_opp

    Valued Member

    Points: 53

    Excellent solution. Took me 2 hours to find this article and then 5 more minutes to fix my problem.

  • ken_opp

    Valued Member

    Points: 53

    At first I thought this worked, but further testing revealed that is corrupted the table. I have two 7.0 SP3 servers and after running sp_fixColOrder, I was able to read my table remotely. However, when I do a simple table join, I got this error:

    Cannot insert the value NULL into column '', table ''; column does not allow nulls. INSERT fails.

    Now this error message (like most) did not make any sense because I'm doing a simple select and join (no update) yet getting an error indicating that an "insert fails".

    Next I tried an sp_help on my table on received many errors. Here are a few:

    Cannot insert the value NULL into column 'index_keys', table 'tempdb.dbo.#spindtab_

    Cannot insert the value NULL into column 'cnst_type', table 'tempdb.dbo.#spcnsttab

    I am sure it is the sp_fixColOrder that caused the error, because I recreated the database from a backup and ran my "join query" before and after running sp_fixColOrder.

    Perhaps the problem is caused by my indexes, default constraints, and/or an identity column.

Viewing 15 posts - 1 through 15 (of 21 total)

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