将.sql文件导入SQL Server 2012

时间:2017-03-16 10:35:00

标签: sql sql-server sql-server-2012

我有.sql的数据库,我想使用Management Studio将.sql文件导入SQL Server 2012。

当我尝试导入数据时,我收到错误:

Msg 156, Level 15, State 1, Line 76
Incorrect syntax near the keyword 'NOT'.


[![enter image description here][1]][1]


 CREATE TABLE ct_bookings(
   id int NOT NULL,
   order_id bigint NOT NULL,
   client_id bigint NOT NULL,
   order_date date NOT NULL,
   booking_date_time datetime NOT NULL,
   service_id int NOT NULL,
   method_id int NOT NULL,
   method_unit_id int NOT NULL,
   method_unit_qty int NOT NULL,
   method_unit_qty_rate double NOT NULL,
   booking_status varchar(10) not null    ('A','C','R','CC','CS','CO','MN','RS') NOT NULL COMMENT 'A=active, C=confirm,   R=Reject, CC=Cancel by Client, CS=Cancel by service   provider,CO=Completed,MN=MARK AS NOSHOW',
  `reject_reason` varchar(200) NOT NULL,
  `reminder_status` enum('0','1') NOT NULL DEFAULT '0' COMMENT '0=Email Not    Sent,1=Email Sent',
  `lastmodify` datetime NOT NULL,
  `read_status` enum('R','U') NOT NULL DEFAULT 'U'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

我该如何解决这个问题?

请帮帮我。提前谢谢。

1 个答案:

答案 0 :(得分:1)

MySQL中的

: -

CREATE TABLE ct_addon_service_rate(
  id int(11) NOT NULL,
  addon_service_id int(11) NOT NULL,
  unit varchar(20) NOT NULL,
  rules VARCHAR(10) NOT NULL CHECK (rules IN('E', 'G')),
  rate DOUBLE NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

SQL Server中的等于: -

Create TABLE ct_addon_service_rate (
  id int NOT NULL,
  addon_service_id int NOT NULL,
  unit varchar(20) NOT NULL,
  rules char(1) not null,
  rate FLOAT(25) NOT NULL,
  CHECK (rules in ('E', 'G'))
)

更新: -

MySQL: -

CREATE TABLE ct_bookings(
   id int NOT NULL,
   order_id bigint NOT NULL,
   client_id bigint NOT NULL,
   order_date date NOT NULL,
   booking_date_time datetime NOT NULL,
   service_id int NOT NULL,
   method_id int NOT NULL,
   method_unit_id int NOT NULL,
   method_unit_qty int NOT NULL,
   method_unit_qty_rate double NOT NULL,
   booking_status varchar(10) not null    ('A','C','R','CC','CS','CO','MN','RS') NOT NULL COMMENT 'A=active, C=confirm,   R=Reject, CC=Cancel by Client, CS=Cancel by service   provider,CO=Completed,MN=MARK AS NOSHOW',
  `reject_reason` varchar(200) NOT NULL,
  `reminder_status` enum('0','1') NOT NULL DEFAULT '0' COMMENT '0=Email Not    Sent,1=Email Sent',
  `lastmodify` datetime NOT NULL,
  `read_status` enum('R','U') NOT NULL DEFAULT 'U'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

SQL Server中的等于: -

CREATE TABLE ct_bookings(
   id int NOT NULL,
   order_id bigint NOT NULL,
   client_id bigint NOT NULL,
   order_date date NOT NULL,
   booking_date_time datetime NOT NULL,
   service_id int NOT NULL,
   method_id int NOT NULL,
   method_unit_id int NOT NULL,
   method_unit_qty int NOT NULL,
   method_unit_qty_rate float(25) NOT NULL,
   booking_status varchar(10) not null  check  (booking_status in ('A','C','R','CC','CS','CO','MN','RS')),
    /*COMMENT 'A=active, C=confirm,   R=Reject, CC=Cancel by Client, CS=Cancel by service   provider,CO=Completed,MN=MARK AS NOSHOW', */
  reject_reason varchar(200) NOT NULL,
  reminder_status char(1)NOT NULL check (reminder_status in ('0','1'))  DEFAULT '0', /*COMMENT '0=Email Not    Sent,1=Email Sent', */
  lastmodify datetime NOT NULL,
  read_status char(1) NOT NULL check (read_status in ('R','U')) DEFAULT 'U'
) 

更新2: -

MySQL中的

: -

CREATE TABLE ct_email_templates (
  id int NOT NULL,
  email_subject varchar(200) COLLATE Latin1_General_CI_AS NOT NULL,
  email_message text COLLATE Latin1_General_CI_AS NOT NULL,
  default_message text COLLATE Latin1_General_CI_AS NOT NULL,
  email_template_status varchar(10) NOT NULL check(email_template_status in('E','D')) COLLATE Latin1_General_CI_AS,
  email_template_type varchar(10) check(email_template_type IN('A','C','R','CC','RS','RM')) COLLATE Latin1_General_CI_AS NOT NULL COMMENT 'A=active, C=confirm, R=Reject, CC=Cancel by Client, RS=Reschedule, RM=Reminder',
  user_type` enum('A','C') COLLATE utf8_unicode_ci NOT NULL COMMENT 'A=Admin,C=client'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

SQL Server中的等于: -

CREATE TABLE ct_email_templates (
  id int NOT NULL,
  email_subject varchar(200) COLLATE Latin1_General_CI_AS NOT NULL,
  email_message text COLLATE Latin1_General_CI_AS NOT NULL,
  default_message text COLLATE Latin1_General_CI_AS NOT NULL,
  email_template_status varchar(10) COLLATE Latin1_General_CI_AS NOT NULL check(email_template_status in('E','D')) ,
  email_template_type varchar(10) COLLATE Latin1_General_CI_AS check(email_template_type IN('A','C','R','CC','RS','RM'))  NOT NULL, /*COMMENT 'A=active, C=confirm, R=Reject, CC=Cancel by Client, RS=Reschedule, RM=Reminder',
  user_type` enum('A','C') COLLATE utf8_unicode_ci NOT NULL COMMENT 'A=Admin,C=client' */
)