SqlDB Field Attributes lazarus / 16-Databases ---------------------------------------------------------------------- RudieD · 2006-03-06 13:41 Does any one know how to extract the Required attribute of a result field on MySQL 4.1/5.0 database ? ---------------------------------------------------------------------- RudieD · 2006-03-06 20:18 I have now tried to Open "describe TableName" but something is blocking it with message "Cannot open a non-select statement". Any other ideas ? ---------------------------------------------------------------------- matthijs · 2006-03-07 07:25 You could check the required property of the field. Something like: Code: [Select]   if SQLQuery1.Fields[0].Required then ShowMessage('required') ---------------------------------------------------------------------- RudieD · 2006-03-07 08:38 Thats the problem, the Required (as well as Prcision) property is not extracted from the result. It has been hard-code as far as I could see. Any other ideas ? ---------------------------------------------------------------------- matthijs · 2006-03-07 11:15 Then you have to ask your DB-server for this information. You could enter a query likeCode: [Select]SELECT COLUMN_NAME, DATA_TYPE, IS_NULLABLE, COLUMN_DEFAULT   FROM INFORMATION_SCHEMA.COLUMNS   WHERE table_name = 'tbl_name'   AND table_schema = 'db_name'   AND column_name LIKE 'column_name' If Is_Nullable then it will not be a required field. Information like this can be easily found on online mysql docs. [edit]Added just one word, but rather important.  :oops: ---------------------------------------------------------------------- RudieD · 2006-03-08 10:32 Thanks matthijs, I'll go have a look there.