Case study 4: Drop all constraints in database
  • Platforms: HP-UNIX 11, Tru64 , Windows
  • Sybase ASE version: 12.5.x and higher
  • Background story: New method for generating database constraints is introduced. In order to create new check constraints, old check constraints had to be deleted
  • Task: Make script which will find all check constraints and drop them from database
  • Solution: Script which finds all check constraints and make another script which drop all check constraint is given in this file. It does not drop rules on database level, but only check constraints.
  • Remark: Sybase has a sort of bug. You can create table level constraint which in its definition has a column which do not exist in that table. Syntax will not be checked on constraint creation. Syntax will be checked on the first insert or update in this table.
   
  powered by myself. DBA-Sybase 2006