Jun 8, 2003 #1 mlara Programmer Oct 22, 2001 32 CO Hi I have the next DDL in MS_SQL Server, which is fine: CREATE TABLE DEMO( IDCHAR CHAR(2) CONSTRAINT NameConstraint CHECK (IDCHAR LIKE '[0-9][A-Z]') ); but on InterBase X does not work. How I can write this so that works on InterBase? Thanks.
Hi I have the next DDL in MS_SQL Server, which is fine: CREATE TABLE DEMO( IDCHAR CHAR(2) CONSTRAINT NameConstraint CHECK (IDCHAR LIKE '[0-9][A-Z]') ); but on InterBase X does not work. How I can write this so that works on InterBase? Thanks.
Jun 9, 2003 Thread starter #2 mlara Programmer Oct 22, 2001 32 CO The problem is that the constraint CHECK does not work. When I attempt save a new register, InterBase generate an error and not allow save it. Which is the equivalent syntax on InterBase for: CHECK (column LIKE '[0-9][A-Z]') ? En español: El problema es que la restricción CHECK no funciona. Cuando intento guardar un nuevo registro, InterBase genera un error y no permite guardarlo. Cuál es la sintaxis equivalente en InterBase para: CHECK (column LIKE '[0-9][A-Z]') ? Upvote 0 Downvote
The problem is that the constraint CHECK does not work. When I attempt save a new register, InterBase generate an error and not allow save it. Which is the equivalent syntax on InterBase for: CHECK (column LIKE '[0-9][A-Z]') ? En español: El problema es que la restricción CHECK no funciona. Cuando intento guardar un nuevo registro, InterBase genera un error y no permite guardarlo. Cuál es la sintaxis equivalente en InterBase para: CHECK (column LIKE '[0-9][A-Z]') ?
Jun 9, 2003 Thread starter #3 mlara Programmer Oct 22, 2001 32 CO Now I have an answer: If I write the script DDL like the next, then now yes it work: CREATE TABLE demo( idcad CHAR(2) CHECK (SUBSTR(idcad, 1, 1) IN ('0', '1') AND SUBSTR(idcad, 2, 2) IN ('1', '2', '3', '4', '5')) ); But still I have a doubt. I can define on InterBase sets of characters like on Delphi, so I can write something like this: CREATE TABLE demo( idcad CHAR(2) CHECK (SUBSTR(idcad, 1, 1) IN set_1 AND SUBSTR(idcad, 2, 2) IN set_2) ); ? Thanks. Upvote 0 Downvote
Now I have an answer: If I write the script DDL like the next, then now yes it work: CREATE TABLE demo( idcad CHAR(2) CHECK (SUBSTR(idcad, 1, 1) IN ('0', '1') AND SUBSTR(idcad, 2, 2) IN ('1', '2', '3', '4', '5')) ); But still I have a doubt. I can define on InterBase sets of characters like on Delphi, so I can write something like this: CREATE TABLE demo( idcad CHAR(2) CHECK (SUBSTR(idcad, 1, 1) IN set_1 AND SUBSTR(idcad, 2, 2) IN set_2) ); ? Thanks.