Subject | Re: [IBO] Re: Changing the Not Null Constraint at run time |
---|---|
Author | Helen Borrie (TeamIBO) |
Post date | 2002-06-01T13:37:39Z |
At 08:01 AM 01-06-02 +0000, you wrote:
objects in the database; although it is not generally a good idea to
create database objects via DSQL in your application.
is not a dataset class. Even if it had been a dataset, it still would only
cause your application to required an entry in that column - it would not
have any effect on the column object in the database. What were you trying
to achieve here?
If you want to apply a Not Null constraint to a column in the database and
you didn't do it at create time, you have no choice but to define a new
column, including that constraint, and move the existing data into
it. This will fail if the existing column contains any nulls.
regards,
Helen Borrie (TeamIBO Support)
** Please don't email your support questions privately **
Ask on the list and everyone benefits
Don't forget the IB Objects online FAQ - link from any page at
www.ibobjects.com
>Thank you for your response.To clarify:
>I am pretty new to IBO and apologise if I am asking silly questions.
>I still can't change the attributes of a column in my codes.
>This is a DDL statement (Data Definition Language). DDL is used to create
>I have the following statement in my code:
>...
>IB_DSQL1.SQL.Text := 'CREATE TABLE COUNTRY(COUNTRYNAME VARCHAR(10)
>NOT NULL , CURRENCY VARCHAR(10))';
>...
objects in the database; although it is not generally a good idea to
create database objects via DSQL in your application.
>I like to add the Not Null Constraint to the Currency Column and haveThis won't do anything. ColumnAttributes act on dataset columns. TIB_DSQL
>done the following:
>...
>IB_Connection1.ColumnAttributes.LinkValues['COUNTRY.CURRENCY']:=
>IB_REQUIRED;
>IB_DSQL1.Prepare;
>IB_DSQL1.Prepared:= True;
>...
is not a dataset class. Even if it had been a dataset, it still would only
cause your application to required an entry in that column - it would not
have any effect on the column object in the database. What were you trying
to achieve here?
If you want to apply a Not Null constraint to a column in the database and
you didn't do it at create time, you have no choice but to define a new
column, including that constraint, and move the existing data into
it. This will fail if the existing column contains any nulls.
>I have also tried, Unprepare, OnPrepareSQL in the code without anyWhat "luck" were you expecting?
>luck.
regards,
Helen Borrie (TeamIBO Support)
** Please don't email your support questions privately **
Ask on the list and everyone benefits
Don't forget the IB Objects online FAQ - link from any page at
www.ibobjects.com