If you can re-create the table (or create some temporary one, transfer
all your data to it, drop old one and rename temporary the same way as
the original table) then you can do it like this:
CREATE TABLE AVP_VAC("avp_id", "vacation_start_date", "vacation_length",
"vacation_status", "vacation_plan_note", "temp_charge_id1",
"temp_charge_id2", "temp_charge_id3", "employee_id", "status",
"created_date", "author_id",
UNIQUE (avp_id, vacation_start_date) ON CONFLICT REPLACE);
It will have the same effect as your CREATE TABLE and CREATE INDEX combined.
Pavel
On Sat, Oct 10, 2009 at 11:35 PM, Hajime MATSUMOTO <[email protected]> wrote:
> thank you for replying my question.
> i am wondering if i can use ALTER TABLE for two columns unique.
> i am showing my sql and also i tryed what you said.
>
> please take a look.
>
> CREATE TABLE AVP_VAC("avp_id", "vacation_start_date", "vacation_length",
> "vacation_status", "vacation_plan_note", "temp_charge_id1",
> "temp_charge_id2", "temp_charge_id3", "employee_id", "status",
> "created_date", "author_id");
> CREATE UNIQUE INDEX vac_index ON AVP_VAC(avp_id, vacation_start_date)
> ON CONFLICT REPLACE;
> SQL error near line 3: near "ON": syntax error
>
>
>
> ALTER TABLE ADD COLUMN UNIQUE(avap_id, vacation_start_date) ON CONFLICT
> REPLACE;
> SQL error near line 3: near "ADD": syntax error
>
> Hajime
>
>
>
> Simon Slavin
>> On 10 Oct 2009, at 9:27am, Hajime MATSUMOTO wrote:
>>
>>
>>> i used to use "CREATE INDEX" with "ON CONFLICT".
>>> i am sure it was able to do on sqlite 2.x.x.
>>> but i tryed on sqlite3 it dose not work.
>>>
>>
>> You can use 'ON CONFLICT' in either of
>>
>> CREATE TABLE
>> ALTER TABLE ADD COLUMN ... UNIQUE
>>
>> but not when defining an INDEX after you've defined the columns it
>> depends on.
>>
>> Simon.
>> _______________________________________________
>> sqlite-users mailing list
>> [email protected]
>> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>>
>
> _______________________________________________
> sqlite-users mailing list
> [email protected]
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users