Subject | {Disarmed} Re: [firebird-support] How can I find a record in a table that has a null value where the field does not allow a null value? |
---|---|
Author | vishualsoft |
Post date | 2009-04-02T16:43:27Z |
> Doug,Hi,
>
> I was trying to find which of 400+ tables might contain this issue without having to manually go thru each table and do what you suggest on every field that should not allow a null value. I was hoping that there is a better way to see if I could possibly have this issue.
>
> Thanks,
> Mike
If the requirement i understood correctly, is to find out the possibility, which are those tables containing such columns with
"Not Null" constraints...
Here is the query to get table names as well as their respective column names which are having "Not Null" constraints...
Query:
*****************************************************************
SELECT A.RDB$RELATION_NAME As "Table Name", B.RDB$TRIGGER_NAME As "Field Name"
FROM RDB$RELATION_CONSTRAINTS A JOIN RDB$CHECK_CONSTRAINTS B
ON A.RDB$CONSTRAINT_NAME = B.RDB$CONSTRAINT_NAME
WHERE
A.RDB$CONSTRAINT_TYPE = 'NOT NULL'
order by A.RDB$RELATION_NAME, B.RDB$TRIGGER_NAME
*****************************************************************
I just hope it will help you up to some extend...
Try it out...
--- In firebird-support@yahoogroups.com, "SoftTech" <miket@...> wrote:
>
> Doug,
>
> I was trying to find which of 400+ tables might contain this issue without having to manually go thru each table and do what you suggest on every field that should not allow a null value. I was hoping that there is a better way to see if I could possibly have this issue.
>
> Thanks,
> Mike
>
>
> ----- Original Message -----
> From: Doug Chamberlin
> To: firebird-support@yahoogroups.com
> Sent: Wednesday, April 01, 2009 5:19 PM
> Subject: {Disarmed} Re: [firebird-support] How can I find a record in a table that has a null value where the field does not allow a null value?
>
>
> SoftTech wrote:
> > I was just wondering if anyone else has found a way to find any record in
> > any and all tables in a Firebird database that should not be null, but is.
> >
> > We all know how we get here. A field is added that allows nulls when first
> > created and then it is later changed to not allow nulls.
> >
> > Any ideas on how this could be done or if there is already any tools out
> > there that will do this?
>
> 1. Change the field back to allow nulls.
> 2. Get rid of the nulls.
> 3. Change the field again to not allow nulls.
>
>
>
>
> [Non-text portions of this message have been removed]
>