In MySQL, the keyword KEY
is simply a synonym for INDEX
. The following two are equivalent:
CREATE TABLE foo (
id SERIAL PRIMARY KEY,
ctime DATETIME,
KEY ctkey (ctime)
);
CREATE TABLE foo (
id SERIAL PRIMARY KEY,
ctime DATETIME,
INDEX ctidx (ctime)
);
In Microsoft SQL Server, the closest equivalent is INDEX
. As far as I can tell, to create an index on a column in Microsoft SQL Server, you use CREATE INDEX
. You can also create constraints that build indexes as part of a CREATE TABLE
statement, but if you just need an index, use CREATE INDEX
.
CREATE TABLE foo (
id BIGINT IDENTITY PRIMARY KEY,
ctime DATETIME
);
CREATE INDEX ctidx ON foo(ctime);
See also documentation on CREATE INDEX
.