Finding empty fields in an table

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-24-2015 07:25 AM
I have an table which contains close to 1000 records and there are about 600 fields in that table.I need to find the fields which are empty for all the records.Can anyone tel me easy/efficient way to do that?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-24-2015 09:00 AM
600 fields???
What table is that ? You need a list like this record has these fields empty ?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-24-2015 09:12 AM
yeah 600 fields, thats an custom table.
As it's not an best practice to have this many fields in an table, we would like to remove the empty one's
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-24-2015 04:09 PM
So you're trying to find out what columns on that table are empty for ALL of its records... so that you can remove the column? Don't even try it, it's not a safe idea to remove a column. Just remove the unwanted fields from the views. If the table really is that big of a mess, and you never want to see those fields again, I would port the good parts of the records over into another, new table that is cleaner and slimmer. You could probably do that with an import set.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-24-2015 04:22 PM
An easy way to find a column that is empty throughout the whole table though is probably like this:
var rec = new GlideRecord('u_my_table'); rec.addNotNullQuery('u_field_maybe_this_is_empty'); rec.query(); if(rec.hasNext()) { gs.print("At least one record on this table has data in this column."); }