Using the query ALTER
#1

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?
Reply
#2

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
Reply
#3

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
Reply
#4

You can't.
Reply
#5

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
Reply
#6

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)