AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   SQL table alter (https://forums.alliedmods.net/showthread.php?t=54423)

pRED* 04-25-2007 06:27

SQL table alter
 
Is there anyway to tell what column exist in a SQL table?

I want to edit the table I use for bf2 rank mod to allow more stuff to be saved.

I know I need to execute a command like this..

Code:

SQL ALTER bf2rank ADD moresavingdata INT(4)...
But how can I check if these columns exists (no point in creating the column every map change..) or how could I remember that the command had been run before so not to do it again.

Using SQLx btw.

Thanks

wonsae 04-25-2007 09:31

Re: SQL table alter
 
Maybe,
PHP Code:

ALTER IF NOT EXISTS lol INT(11

or soemthing?

Silencer123 04-27-2007 10:10

Re: SQL table alter
 
Code:

SELECT * FROM bf2rank WHERE `anything`='something'
[...]
if(result>=RESULT_OK) ...


Deviance 04-27-2007 13:11

Re: SQL table alter
 
http://forums.alliedmods.net/showthr...740#post463740

pRED* 04-27-2007 18:00

Re: SQL table alter
 
That's just a table select deviance.
I was talking about adding more columns to an existing db not adding another row of data.

Anyway don't worry I just created a second table..

Deviance 04-27-2007 18:28

Re: SQL table alter
 
Quote:

Originally Posted by pRED* | NZ (Post 470435)
That's just a table select deviance.
I was talking about adding more columns to an existing db not adding another row of data.

Anyway don't worry I just created a second table..

Yeah, but it was more just to give the idea of how to do it :P


All times are GMT -4. The time now is 06:36.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.