Creating a new column with SQL
Hi everybody
I am working on an online game, but I am running into some trouble.
As the database is getting heavy, right now 4,5 megabyte, I can't download the database evrytime I want to make some changes.
Therefore I would like to know, if there are any SQL statements that will create a new column in the database.
I suppose that the statement would be something like:
CREATE COLUMN referer SET defualt.value = 'NONE'
but I don't think that that one would work anyhow...
Can someone help me out here? I really hope that you can.
If you are interested in seing the game, it can be found at:
http://www.secretsofwar.vze.com (it is still under construction though)
Kind regards, and thanks in advance
~Casper Bang
Peter J. Boettcher posted this at 14:02 — 10th January 2001.
They have: 812 posts
Joined: Feb 2000
Casper,
I'm not sure which platform you're using but for Microsoft SQL 6.5-2000 the syntax is:
ALTER TABLE table_name
ADD column_name column_type value
for example:
ALTER TABLE Games ADD Game_Title VARCHAR(20) NULL
It's probably similar on other platforms.
PJ | Are we there yet?
pjboettcher.com
hotcut posted this at 14:57 — 10th January 2001.
They have: 133 posts
Joined: Sep 2000
Thanks Peter
I will look at it, and see if I can make it work.
Kind regards
~Casper
hotcut posted this at 17:03 — 10th January 2001.
They have: 133 posts
Joined: Sep 2000
Tested it out, and it worked perfectly! Thanks a lot again! You spared my connection for a lot
See yóu
¨~Casper
hotcut posted this at 13:42 — 13th January 2001.
They have: 133 posts
Joined: Sep 2000
I ran into another problem regarding this!
I know wants to make a new row, that is in memo type, so that you can have ALL the data you wants in the cells.
How do I do that?
I suppose its something like:
ALTER TABLE Games ADD Game_Title VARCHAR(memo) NULL
But I aint sure on that... I REALLY hope that you can help me here!
Thanks in advance
Casper
Peter J. Boettcher posted this at 16:42 — 13th January 2001.
They have: 812 posts
Joined: Feb 2000
Casper,
The memo field type in SQL is TEXT. So the statement would be:
ALTER TABLE Games ADD Game_Title TEXT NULL
Try not to use to many TEXT fields since they aren't super efficient.
PJ | Are we there yet?
pjboettcher.com
hotcut posted this at 15:47 — 14th January 2001.
They have: 133 posts
Joined: Sep 2000
Thanks for that!
hotcut posted this at 12:40 — 27th January 2001.
They have: 133 posts
Joined: Sep 2000
By the way, what do you mean that they are not effecient? Is it just because that they are heavy in the data weight, or is there a more specifik reason?
Peter J. Boettcher posted this at 15:27 — 27th January 2001.
They have: 812 posts
Joined: Feb 2000
Casper,
The text field is inefficient in two ways:
1) It requires more memory overhead than a char or varchar type field.
2) Indexing/Searching is slower through a text field compared to a char or varchar field.
If you know you're not going to exceed 6,000-8,000 characters I would recommend going with a varchar data type instead of text.
PJ | Are we there yet?
pjboettcher.com
hotcut posted this at 15:36 — 27th January 2001.
They have: 133 posts
Joined: Sep 2000
I don't know how much information there will be, so I better keep it as a text field.
Thanks anyway
If you want to see what I am using it for, here is the URL http://www.secretsofwar.net Just if you were curius.
~Casper
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.