![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
|
Hi, CREATE TABLE ... "file" varchar(100) NOT NULL UNIQUE unfortunately I forgot to use "UNIQUE" when I created the table. I searched the docs, but only found a way to alter if the column has an index. How can I alter the table if the column has no index? |
#2
| |||
| |||
|
|
CREATE TABLE ... "file" varchar(100) NOT NULL UNIQUE unfortunately I forgot to use "UNIQUE" when I created the table. I searched the docs, but only found a way to alter if the column has an index. How can I alter the table if the column has no index? Create a new unique index for the particular column. |
#3
| |||
| |||
|
|
Thomas Guettler <guettli.usenet (AT) thomas-guettler (DOT) de> wrote: CREATE TABLE ... "file" varchar(100) NOT NULL UNIQUE unfortunately I forgot to use "UNIQUE" when I created the table. I searched the docs, but only found a way to alter if the column has an index. How can I alter the table if the column has no index? Create a new unique index for the particular column. I'd recommend that you add a unique constraint rather than an unique index. Both add an index, but this way there is also a constraint definition. Syntax: ALTER TABLE t ADD CONSTRAINT indexname UNIQUE (file); |
#4
| |||
| |||
|
|
CREATE TABLE ... "file" varchar(100) NOT NULL UNIQUE unfortunately I forgot to use "UNIQUE" when I created the table. I searched the docs, but only found a way to alter if the column has an index. How can I alter the table if the column has no index? Create a new unique index for the particular column. I'd recommend that you add a unique constraint rather than an unique index. Both add an index, but this way there is also a constraint definition. I can't see any differences. (except for the index-names) |
#5
| |||
| |||
|
|
Ok, here's the difference: |
#6
| |||
| |||
|
|
Oh, thanks for the clarification. |
#7
| |||
| |||
|
|
Andreas Kretschmer <akretschmer (AT) spamfence (DOT) net> wrote: Oh, thanks for the clarification. Klar, gerne. Irgendwie komisch, einen Thread mit 3 deutschsprachigen Leuten auf Englisch zu haben :^) |
#8
| |||
| |||
|
|
begin Laurenz Albe schrieb: Andreas Kretschmer <akretschmer (AT) spamfence (DOT) net> wrote: Oh, thanks for the clarification. Klar, gerne. Irgendwie komisch, einen Thread mit 3 deutschsprachigen Leuten auf Englisch zu haben :^) Hehe, daß dachte ich auch schon die ganze Zeit... |
![]() |
| Thread Tools | |
| Display Modes | |
| |