none
Strange Behavior: SQL Server 2008 & sql Server Management studio -- UniquieIdentifer spontaneously changed to Varchar

    Question

  • Today, while modifying a table that has a foreign key to our departments table, everything seemed to go smoothly. Then I noticed the relationship to the departments table had disappeared. I tried to restore it and got an error that the columns were not the same data type or length. Checking the departments table, I found the uniqueidentifier that provided the foreign key in Table A had chnaged to a varchar(50). Not sure how this happened, but I'm not accepting that the server is haunted. Anybody else heard of this?

    Many thanks!

    RJ Ohrstedt

    • Edited by ROinATL Wednesday, August 28, 2013 2:06 AM leff off signature
    Wednesday, August 28, 2013 2:04 AM

Answers

All replies

  • I found the uniqueidentifier that provided the foreign key in Table A had chnaged to a varchar(50). Not sure how this happened, but I'm not accepting that the server is haunted. Anybody else heard of this?

    Hello,

    No, never heard of and I don't believe that SQL Server changes data type on it's own / caused by a bug.

    In SSMS open the "Schema Changes History" report on the database to see, when & who may changed the data type.


    Olaf Helper

    [ Blog] [ Xing] [ MVP]

    Wednesday, August 28, 2013 4:37 AM
  • In addition to Olaf notes, it's good to create DDL trigger to track database changes. For more info please see this article:

    SQL Server DDL Triggers to Track All Database Changes

    The RDBMS itself is designed to protect the data and keep its INTEGRITY. Nothing in database happen spontaneously that changes INTEGRITY.


    The most important motivation for the research work that resulted in the relational model was the objective of providing a sharp and clear boundary between the logical and physical aspects of database management. - E. F. Codd


    My blog

    Wednesday, August 28, 2013 5:38 AM
  • My guess is that you are using the GUI to do schema changes. I've seen issues with the GUI, and possibly that can be a reason why making schema changes from the GUI is disables by default. If you can repro this, then I suggest you file a bug at connect.Microsoft.com.

    Tibor Karaszi, SQL Server MVP | web | blog

    Wednesday, August 28, 2013 5:45 AM