This is a discussion on Factoring Enum Out of Code within the MySQL Database forums, part of the Database Forums category; I am writing a batch file to create some tables. Two or more of these tables have a field called ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
I am writing a batch file to create some tables. Two or more of these
tables have a field called category which should be an ENUM. As its a big ENUM, say 100 entries, I dont like to reproduce its definition twice. Is there any preprocessing syntax that can be used to improve the code? Have: CREATE TABLE t1 ( category ENUM ( ... ), .... ) CREATE TABLE t2 ( category ENUM ( ... ), .... ) Conceptually I want: CATEGORY_ENUM = ENUM (...) CREATE TABLE t1 ( category CATEGORY_ENUM, .... ) CREATE TABLE t2 ( category CATEGORY_ENUM, .... ) |
|
|||
|
On 24 May, 10:47, pietro...@gmail.com wrote:
> I am writing a batch file to create some tables. Two or more of these > tables have a field called category which should be an ENUM. As its a > big ENUM, say 100 entries, I dont like to reproduce its definition > twice. Is there any preprocessing syntax that can be used to improve > the code? > > Have: > > CREATE TABLE t1 ( > category ENUM ( ... ), > .... > ) > > CREATE TABLE t2 ( > category ENUM ( ... ), > .... > ) > > Conceptually I want: > > CATEGORY_ENUM = ENUM (...) > > CREATE TABLE t1 ( > category CATEGORY_ENUM, > .... > ) > > CREATE TABLE t2 ( > category CATEGORY_ENUM, > .... > ) With that size of ENUM firld, I would be looking at a separate Category table instead. |
|
|||
|
On May 24, 11:01 am, Captain Paralytic <paul_laut...@yahoo.com> wrote:
> On 24 May, 10:47, pietro...@gmail.com wrote: > > > > > I am writing a batch file to create some tables. Two or more of these > > tables have a field called category which should be an ENUM. As its a > > big ENUM, say 100 entries, I dont like to reproduce its definition > > twice. Is there any preprocessing syntax that can be used to improve > > the code? > > > Have: > > > CREATE TABLE t1 ( > > category ENUM ( ... ), > > .... > > ) > > > CREATE TABLE t2 ( > > category ENUM ( ... ), > > .... > > ) > > > Conceptually I want: > > > CATEGORY_ENUM = ENUM (...) > > > CREATE TABLE t1 ( > > category CATEGORY_ENUM, > > .... > > ) > > > CREATE TABLE t2 ( > > category CATEGORY_ENUM, > > .... > > ) > > With that size of ENUM firld, I would be looking at a separate > Category table instead. Thats a helpful suggestion thanks, but for arguments sake is what I originally asked about possible in any way? |
|
|||
|
pietromas@gmail.com wrote:
> On May 24, 11:01 am, Captain Paralytic <paul_laut...@yahoo.com> wrote: >> On 24 May, 10:47, pietro...@gmail.com wrote: >> >> >> >>> I am writing a batch file to create some tables. Two or more of these >>> tables have a field called category which should be an ENUM. As its a >>> big ENUM, say 100 entries, I dont like to reproduce its definition >>> twice. Is there any preprocessing syntax that can be used to improve >>> the code? >>> Have: >>> CREATE TABLE t1 ( >>> category ENUM ( ... ), >>> .... >>> ) >>> CREATE TABLE t2 ( >>> category ENUM ( ... ), >>> .... >>> ) >>> Conceptually I want: >>> CATEGORY_ENUM = ENUM (...) >>> CREATE TABLE t1 ( >>> category CATEGORY_ENUM, >>> .... >>> ) >>> CREATE TABLE t2 ( >>> category CATEGORY_ENUM, >>> .... >>> ) >> With that size of ENUM firld, I would be looking at a separate >> Category table instead. > > Thats a helpful suggestion thanks, but for arguments sake is what I > originally asked about possible in any way? > No. But any halfway decent text editor will allow you to copy/paste. -- ================== Remove the "x" from my email address Jerry Stuckle JDS Computer Training Corp. jstucklex@attglobal.net ================== |