首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >将.sql文件导入SQL Server2012

将.sql文件导入SQL Server2012
EN

Stack Overflow用户
提问于 2017-03-16 18:35:00
回答 1查看 97关注 0票数 1

我有带有.sql的数据库,我想使用Management Studio将该.sql文件导入到SQL Server2012中。

当我试图导入数据时,我得到了一个错误:

代码语言:javascript
复制
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;

我该如何解决这个问题?

请帮帮我。提前谢谢。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-03-16 19:30:25

MySQL中:

代码语言:javascript
复制
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中等于:-

代码语言:javascript
复制
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中:

代码语言:javascript
复制
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中等于:-

代码语言:javascript
复制
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中:

代码语言:javascript
复制
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中等于:-

代码语言:javascript
复制
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' */
)
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/42831565

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档