Search code examples
sqlconstraintssqlanywheresql-drop

Sybase SQL Anywhere drop all constraints on a column


Is it possible in SAP Sybase SQL Anywhere 12.0.1 to drop all constrains with a simple and single line of code for a specific column in a table? I know I can get them via sys-tables, but maybe there is some easier way of doing this.

Thank you very much!


Solution

  • No, you can't drop multiple constraints with a single statement.

    You can use ALTER TABLE to drop individual constraints, so ALTER TABLE mytable ALTER mycolumn DROP CONSTRAINT constraint-name, but you must execute the statement separately for each constraint you want to drop.

    Disclaimer: I work for SAP in SQL Anywhere engineering.