Removing Table Constraints in SQL Database for O-Ring Creation/Modification.

Removing Table Constraints in SQL Database for O-Ring Creation/Modification.

When migrating the MDTools library from an Access database to SQL, certain constraints are applied to tables. These constraints prevent users from saving new or modified data in the library. For example, the picture below illustrates the constraints imposed on the O-ring table during migration, leading to users being unable to create O-rings in the database.


To search and remove all current table constraints from the database using SQL Server Management Studio, kindly follow the steps below. 
1. In Microsoft SQL Server Management Studio, right-click on the database (containing table constraints) and select New Query.
   

2. Copy the below highlighted query and paste on the query field.
select 'alter table ' + t.name + ' drop constraint ' + c.name
from sys.tables t
    inner join sys.check_constraints c on c.parent_object_id = t.object_id
where c.name like '%disallow_zero_length'


3. Execute the query. or press F5.

4. All the table constraints will appear in the result list. Now from the list, copy all the constraints and paste them in the query field (remove the previous query).


5. Execute the query. or press F5. 


6. Once executed successfully, you will get message.


Follow the same steps for other database.

After removing the table constraints from the database, attempt to create the O-ring or any other data that was previously encountering issues.