在 Teradata 中查找具有 NULL 值的列 [英] Find columns with NULL values in Teradata

查看:151
本文介绍了在 Teradata 中查找具有 NULL 值的列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在表中查找包含空值的列.是否有包含该信息的系统表?

I would like to find the columns in a table that has a null value in it. Is there a system table that have that information?

推荐答案

要查找允许空"值的列,请尝试...

To find columns where "null" values are allowed try...

select *
from dbc.columns 
where databasename = 'your_db_name'
and tablename = 'your_table_name'
and Nullable = 'Y'

然后要识别具有空值的特定行,从之前的结果集中获取ColumnName"并运行查询以识别结果......如果您想对它们采取进一步的行动,也许将它们扔到一个易失性表中(更新、删除).

then to identify the specific rows w/ null values, take the "ColumnName" from the previous result set and run queries to identify results... perhaps throw them in a volatile table if you want to take further action on them (update,delete).

-- for example you found out that column "foo" is nullable... 
create volatile table isnull_foo_col
as
(
  sel * 
  from your_table_name 
  where foo is null
) with data 
on commit preserve rows;

这篇关于在 Teradata 中查找具有 NULL 值的列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆