Apr 6, 2005 #1 soasi Programmer Joined Apr 6, 2005 Messages 1 Location PL Please help me if you can I have table with simple data. all of fields have default value how to read this default value, using php thanks for help
Please help me if you can I have table with simple data. all of fields have default value how to read this default value, using php thanks for help
Apr 7, 2005 #2 rac2 Programmer Joined Apr 26, 2001 Messages 1,871 Location US The values used for defaults are stored in the data dictionary, also known as the INFORMATION_SCHEMA. See http://dev.mysql.com/doc/mysql/en/columns-table.html From that resource I learned that you can find the default for a column with this query. Code: SELECT COLUMN_NAME, COLUMN_DEFAULT FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name = 'tbl_name' [AND schema_name = 'db_name'] [AND column_name LIKE 'wild'] The clauses in brackets are optional. Also there should be a way to get the same information from the SHOW command. Code: SHOW COLUMNS FROM tbl_name [FROM db_name] [LIKE wild] Hope I understood your question and that this is helpful. Upvote 0 Downvote
The values used for defaults are stored in the data dictionary, also known as the INFORMATION_SCHEMA. See http://dev.mysql.com/doc/mysql/en/columns-table.html From that resource I learned that you can find the default for a column with this query. Code: SELECT COLUMN_NAME, COLUMN_DEFAULT FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name = 'tbl_name' [AND schema_name = 'db_name'] [AND column_name LIKE 'wild'] The clauses in brackets are optional. Also there should be a way to get the same information from the SHOW command. Code: SHOW COLUMNS FROM tbl_name [FROM db_name] [LIKE wild] Hope I understood your question and that this is helpful.