| | |
SET datatype
Please support our MySQL advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
0
#2 34 Days Ago
Hey.
I don't know of a MySQL statement that is capable of fetching those values in such a way that it can be return as a table, and I am unable to find one in the manual. (Although, it may well have eluded my brief search.)
Usually, the structure of a database is not dynamic, so columns defined as SET or ENUM would have fixed values, eliminating the need to actually read them out of the database. They could just be hard-coded into the front-end, as they should never actually change.
If the values of your SET column are supposed to be dynamic, you really shouldn't be using that type. Only data is supposed to be dynamic, not the structure of the database. You would probably be best of removing said SET column, creating a table for these values and using a N:M relationship to link them to the original table.
However, if you for some reason want to use a dynamic table structure (which I highly recommend against), then you could have PHP read the values from your SET column using the SHOW COLUMNS command.
See this blog for example.
I don't know of a MySQL statement that is capable of fetching those values in such a way that it can be return as a table, and I am unable to find one in the manual. (Although, it may well have eluded my brief search.)
Usually, the structure of a database is not dynamic, so columns defined as SET or ENUM would have fixed values, eliminating the need to actually read them out of the database. They could just be hard-coded into the front-end, as they should never actually change.
If the values of your SET column are supposed to be dynamic, you really shouldn't be using that type. Only data is supposed to be dynamic, not the structure of the database. You would probably be best of removing said SET column, creating a table for these values and using a N:M relationship to link them to the original table.
However, if you for some reason want to use a dynamic table structure (which I highly recommend against), then you could have PHP read the values from your SET column using the SHOW COLUMNS command.
See this blog for example.
Please do not ask for help in a PM. Use the forums.
And use [code] tags!
And use [code] tags!
![]() |
Similar Threads
- Lost path (VB.NET)
- Insert a struct in a set (C++)
- Stored procedure and datatype TEXT (ASP) (MS SQL)
- 2008 displaying the task category vista event logs (VB.NET)
- problem with template of a generic datatype (C++)
- class file in vb.net (VB.NET)
- Anyone a VB.NET Guru? (VB.NET)
- New Portal set up (DaniWeb Community Feedback)
Other Threads in the MySQL Forum
- Previous Thread: Stored Procedures Help please
- Next Thread: SQL statement for easier db a search
| Thread Tools | Search this Thread |
agplv3 alfresco amazon api aws bizspark breathalyzer changingprices cmg communityjournalism contentmanagement contractors copyright count court crm data database design developer development distinct drupal dui ec2 email enter enterprise eudora facebook form foss gartner gnu government gpl groklaw groupware hiring hyperic images innerjoins insert ip joebrockmeier join journalism keyword keywords kickfire laptop law legal license licensing linux maintenance managing mariadb matchingcolumns metron micromanage microsoft microsoftexchange mindtouch montywidenius mozilla multiple mysql mysqlcolumnupdating mysqldatetimeordermax() mysqlindex mysqlinternalqueries mysqlquery mysqlsearch news open-xchange opendatabasealliance opengovernment opensource oracle penelope php priceupdating query referencedesign reorderingcolumns resultset select sharepoint simpledb sourcecode spotify sql sugarcrm syntax techsupport thunderbird transparency virtualization





