开发者

MySQL CREATE statement in MSSQL : the KEY keyword?

开发者 https://www.devze.com 2023-03-14 12:35 出处:网络
I have SQL CREATE statements for MySQL. They have KEY. Example : CREATE TABLE a ( a varchar(25) NOT NU开发者_运维知识库LL DEFAULT \'\',

I have SQL CREATE statements for MySQL. They have KEY.

Example :

CREATE TABLE a (
  a varchar(25) NOT NU开发者_运维知识库LL DEFAULT '',
  b varchar(20) NOT NULL DEFAULT '',
  KEY location (a)
);

What is the CREATE statement for this table in MSSQL ? The KEY keyword does cause problem.


CREATE TABLE database1.dbo.a (
  a nvarchar(25),
  b nvarchar(25),
)
GO

CREATE INDEX a_index
  ON database1.dbo.a(a)
GO

...change db and schema names


if key is the column name, you could use square brackets to surround it..and then run the sql statement, like this: [KEY]

0

精彩评论

暂无评论...
验证码 换一张
取 消