SQL create column if not exists
What query to use if I want to create a column if it does not exist?
|
Re: SQL create column if not exists
PHP Code:
|
Re: SQL create column if not exists
Quote:
|
Re: SQL create column if not exists
PHP Code:
It's because 1 slot = 1 column, eg. FetchInt(column number). We don't want to switch places on the column numbers. |
Re: SQL create column if not exists
You shouldn't dynamically create columns, that means your database design is wrong.
If you explain what kind of data you're trying to store, someone can probably give you the correct solution. |
Re: SQL create column if not exists
@DJ Tsunami
My concern was to add columns to a database which is used by another plugin. |
Re: SQL create column if not exists
Quote:
|
Re: SQL create column if not exists
Try this: CREATE TABLE tablename (column), of course you cann add more columns (column, column)
|
Re: SQL create column if not exists
@Ermert1992
That's what I said... >:[ |
Re: SQL create column if not exists
You can use ALTER TABLE to add new columns.
ALTER TABLE tablename ADD columname columntype The more rows your table has, the longer ALTER TABLE will take. Edit: Having said that, this is an operation you should be doing manually and as a one-off thing. |
All times are GMT -4. The time now is 06:44. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.