SA-MP Forums Archive
Using the query ALTER - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Using the query ALTER (/showthread.php?tid=639420)



Using the query ALTER - JaKe Elite - 17.08.2017

How do I use the query ALTER, I am making some changes on JakAdmin's Database for the next update and it requires a new column (making some optimizations)

Currently I can only add new columns with ALTER (and seen the RENAME feature of it)

I have tried using DROP option but it doesn't work.

So the question is how do I remove a column with ALTER?


Re: Using the query ALTER - 10MIN - 17.08.2017

Use:
PHP код:
ALTER TABLE NameOfTable
DROP COLUMN NameOfColumnToBeDeleted

PS: If you need any other information about MySQL, you can get it here: MySQL 5.7 Reference Manual


Re: Using the query ALTER - JaKe Elite - 17.08.2017

Quote:
Originally Posted by 10MIN
Посмотреть сообщение
Use:
PHP код:
ALTER TABLE NameOfTable
DROP COLUMN NameOfColumnToBeDeleted

PS: If you need any other information about MySQL, you can get it here: MySQL 5.7 Reference Manual
I am doing this on SQLite as I cannot use MySQL at the moment, using a shitty PC.

PHP код:
db_query(Database"ALTER TABLE `users` DROP COLUMN `test`;"); 
Returns a SQL Debug error

Код:
[Warning] db_query: Query failed: near "DROP": syntax error



Re: Using the query ALTER - GoldenLion - 17.08.2017

You can't.


Re: Using the query ALTER - JaKe Elite - 17.08.2017

There's no other way on doing it in game without accessing the SQLite Database Browser? I really, really need it for my next upcoming JakAdmin3 update


Re: Using the query ALTER - Vince - 17.08.2017

Just use a GUI to do it, really. DDL statements really shouldn't be hard coded unless you're writing some kind of run once upgrade script.