locked
TSD01268: The schema update is terminating because data loss might occur.

    Question

  • I created the local database as sa and am logging into as sa and I am getting this error:

    TSD01268: .Net SqlClient Data Provider: Msg 50000, Level 16, State 127, Line 7 Rows were detected. The schema update is terminating because data loss might occur. SchemaCompare1 0 0 

    How do I fix it?
    Sunday, July 5, 2009 9:54 PM

Answers

  • When you are making a change in your physical table structure that does not have an implicit conversion or you are changing to a smaller data type for example from int to smallint or nvarchar(10) to nvarchar(5), or when you might loose data due to loss of type fidelity when you convert nvarchar(10) to varchar(10) for example, the system will generate a block in the deployment script to check if you have rows in the table(s) you are modifying and if rows are detected it will exit the deployment with this message.

    There are a couple of ways to deal with this:

    1) Uncheck the deployment option "Block incremental deployment if data loss might occur" this will cause the check to be ignored and now you are exposed to runtime failure during deployment
    2) Handle it inside the pre- and post-deployment script, by converting it manually
    3) Be more restrictive in the type of physical table structures that you allow.



    GertD @ www.DBProj.com
    Monday, July 6, 2009 1:31 AM

All replies

  • When you are making a change in your physical table structure that does not have an implicit conversion or you are changing to a smaller data type for example from int to smallint or nvarchar(10) to nvarchar(5), or when you might loose data due to loss of type fidelity when you convert nvarchar(10) to varchar(10) for example, the system will generate a block in the deployment script to check if you have rows in the table(s) you are modifying and if rows are detected it will exit the deployment with this message.

    There are a couple of ways to deal with this:

    1) Uncheck the deployment option "Block incremental deployment if data loss might occur" this will cause the check to be ignored and now you are exposed to runtime failure during deployment
    2) Handle it inside the pre- and post-deployment script, by converting it manually
    3) Be more restrictive in the type of physical table structures that you allow.



    GertD @ www.DBProj.com
    Monday, July 6, 2009 1:31 AM
  • I am getting the same error. I have a large database that I am attempting to deploy changes generated from a Schema Compare against a manually maintained control database and getting this error... however, it does not seem to give info on exactly where it is failing. There are thousands of changes, so how do I go about finding which command is failing?

    IOW, "Error TSD01268: .Net SqlClient Data Provider: Msg 50000, Level 16, State 127, Line 7 Rows were detected. The schema update is terminating because data loss might occur" is not detailed enough.
    Tuesday, August 4, 2009 6:01 PM
  • I'm using VS2010 Premium RTMRel and TFS 2010.  I get this message even when Block Incremental IS unchecked.

    Now, how do I do an incremental deployment to our new project database (where I don't care about killing data in the rows I'm modifying yet) if this checkbox seems not to do what it is supposed to?  I want to keep 'some' of the data in the tables or I'd just recreate the DB every time.  This checkbox seems to be broken.


    Tim Carper
    Monday, June 14, 2010 10:04 PM
  • I am also getting the same error message even though i have this checkbox UNCHECKED.  I am using VS2010 Ultimate RTM and TFS 2010 a well.
    Thursday, July 22, 2010 6:27 PM
  • I've run into this issue as well. The only workaround I've found is to modify the structure of the target table inside SSMS, then run the compare again. I can't recall if I had the 'block incremental deployment' box checked or not, but doing it this way seems to work by effectively bypassing the error all together.
    Friday, September 10, 2010 3:05 AM