Reputation: 437
I need to know if it's possible to know if a Column is "Required" or "Nullable". I can't find any information about this. Is there any Stored Procedure that let's me know if the column is a required field ?
Upvotes: 0
Views: 240
Reputation: 21004
Oracle
SELECT nullable
FROM user_tab_columns
WHERE table_name = 'TableName'
AND column_name = 'ColumnName';
SQL-SERVER
SELECT is_nullable
FROM sys.columns
WHERE object_id = object_id('TableName')
AND name = 'ColumnName';
MySQL
SELECT IS_NULLABLE
FROM information_schema.columns
WHERE TABLE_NAME = 'TableName'
AND COLUMN_NAME = 'ColumnName';
Upvotes: 3