On May 15, 2011, at 5:05 PM, romtek wrote:

> On Sun, May 15, 2011 at 4:39 PM, Simon Slavin <slav...@bigfraud.org> wrote:
> 
>> 
>> On 15 May 2011, at 10:33pm, romtek wrote:
>> 
>>> So, I am asking developers of SQLite to make it easy for tool developers
>> to
>>> offer the ability to rename attributes.
>> 
>> The SQL specification does not use the term 'attribute' in any way that
>> would give them names.  Can you explain what you mean by 'rename attributes'
>> ?  Perhaps give an example.
>> 
>> Simon.
>> 
> 
> 
> OK, I will give you an example, and you correct my use of the terms, please.
> 
> A table:
> 
> id, eventName, date
> 
> I want to rename date to dateAdded.
> 


sqlite doesn't support changing the name of a table column (and, neither you 
nor your user should be doing this -- there is something strange with your app 
requirements). That said, you can "rename" a column by creating a new table 
with the new column definitions and copy data from the old table to the new 
table.

CREATE TABLE new_table (id, eventName, dateAdded);
INSERT INTO new_table (id, eventName, dateAdded) SELECT id, eventName, date 
FROM old_table;

> People currently jump through hoops in order to achieve such a simple (from
> the user's point of view) and needed goal:
> http://stackoverflow.com/questions/805363/how-do-i-rename-a-column-in-a-sqlite-database-table
> .
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to