InDev Posted December 1, 2009 Share Posted December 1, 2009 (edited) Hi, I'm new in MTA Scripting i learned some things and i have a problem with an SQL Query : Here is the script: function SQLDelColumnInTable( thePlayer, commandName, tabletarget, column ) local query = executeSQLQuery( "ALTER TABLE ? DROP COLUMN ? ", tabletarget, column ) if(query)then outputChatBox( "Column: " ..column.. " in table "..tabletarget.." has been deleted !", thePlayer ) else outputChatBox( "The column can't be deleted, an error has occured", thePlayer ) end end addCommandHandler( "deletecolumn", SQLDelColumnInTable ) And When i test my command the Server send me this error message: ERROR: Database query failed: near "DROP": syntax error Can someone help me ? Edited December 1, 2009 by Guest Link to comment
Xalphox Posted December 1, 2009 Share Posted December 1, 2009 Hi, I'm new in MTA Scripting i learned some things and i have a problem with an SQL Query :Here is the script: function SQLDelColumnInTable( thePlayer, commandName, tabletarget, column ) local query = executeSQLQuery( "ALTER TABLE ? DROP COLUMN ? ", tabletarget, column ) if(query)then outputChatBox( "Column: " ..column.. " in table "..tabletarget.." has been deleted !", thePlayer ) else outputChatBox( "The column can't be deleted, an error has occured", thePlayer ) end end addCommandHandler( "deletecolumn", SQLDelColumnInTable ) And When i test my command the Server send me this error message: ERROR: Database query failed: near "DROP": syntax error Can someone help me ? May need to embed it in `'s ("ALTER TABLE `?` DROP COLUMN `?`;") Link to comment
InDev Posted December 1, 2009 Author Share Posted December 1, 2009 No it send me the same Error message I think the MTA'SQL does not recognize the DROP COLUMN and he think it is an syntax error so if there is any other way to delete a Column i'll try it... Link to comment
robhol Posted December 1, 2009 Share Posted December 1, 2009 Only the RENAME TABLE and ADD COLUMN variants of the ALTER TABLE command are supported. Other kinds of ALTER TABLE operations such as DROP COLUMN, ALTER COLUMN, ADD CONSTRAINT, and so forth are omitted. Oops, looks like you're at a dead end. Why would you want to drop columns at runtime anyways? 1 Link to comment
InDev Posted December 1, 2009 Author Share Posted December 1, 2009 Because i made infos of players in a table, then i created a command for add columns, who works perfectly now, but in the beginning i had a bug, the command must set a default valor (a valor that i choose ( 0 ) ) but the command did'nt set this valor that's why i want to delete it it takes place for just a test columns... I repaired the create command, but you can see that the delete does'nt work ^^ So if i can use anything else except recreate the table, i'll try it. Link to comment
subenji99 Posted December 1, 2009 Share Posted December 1, 2009 Most of us use http://sourceforge.net/projects/sqlitebrowser/ for database cleanup from our mistakes. Just don't run it while your server is running. Link to comment
InDev Posted December 1, 2009 Author Share Posted December 1, 2009 Where is the database please ? Link to comment
subenji99 Posted December 1, 2009 Share Posted December 1, 2009 It is your "registry.db" file in your server folder. Link to comment
InDev Posted December 1, 2009 Author Share Posted December 1, 2009 It is your "registry.db" file in your server folder. Thank you subenji99 Thnk you very much guys my problem it's to the past now Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now