SQL新建表语句错误
SETFOREIGN_KEY_CHECKS=0;--------------------------------Tablestructurefor`t_base_devi...
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for `t_base_device`
-- ----------------------------
DROP TABLE IF EXISTS `t_base_device`;
CREATE TABLE `t_base_device` (
`deviceid` int(10) NOT NULL,
`devicecode` varchar(50) DEFAULT NULL,
`devicename` varchar(50) DEFAULT NULL,
`deviceclassno` varchar(10) DEFAULT NULL,
`status` varchar(10) DEFAULT NULL,
`username` varchar(50) DEFAULT NULL,
`userdept` varchar(200) DEFAULT NULL,
PRIMARY KEY (`deviceid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of t_base_device
-- ----------------------------
INSERT INTO `t_base_device` VALUES ('10001', 'STPC201711001', '华硕X550', '0101', '使用中', '谢红卫', '软件研发部');
INSERT INTO `t_base_device` VALUES ('10002', 'STPC201711002', '联想T440P', '0101', '库存', null, null);
为什么会报错
错误信息:
[SQL]SET FOREIGN_KEY_CHECKS=0
[Err] 42000 - [SQL Server]'=' 附近有语法错误。
求大佬帮改成sql server语句
这是mysql语句 展开
-- ----------------------------
-- Table structure for `t_base_device`
-- ----------------------------
DROP TABLE IF EXISTS `t_base_device`;
CREATE TABLE `t_base_device` (
`deviceid` int(10) NOT NULL,
`devicecode` varchar(50) DEFAULT NULL,
`devicename` varchar(50) DEFAULT NULL,
`deviceclassno` varchar(10) DEFAULT NULL,
`status` varchar(10) DEFAULT NULL,
`username` varchar(50) DEFAULT NULL,
`userdept` varchar(200) DEFAULT NULL,
PRIMARY KEY (`deviceid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of t_base_device
-- ----------------------------
INSERT INTO `t_base_device` VALUES ('10001', 'STPC201711001', '华硕X550', '0101', '使用中', '谢红卫', '软件研发部');
INSERT INTO `t_base_device` VALUES ('10002', 'STPC201711002', '联想T440P', '0101', '库存', null, null);
为什么会报错
错误信息:
[SQL]SET FOREIGN_KEY_CHECKS=0
[Err] 42000 - [SQL Server]'=' 附近有语法错误。
求大佬帮改成sql server语句
这是mysql语句 展开
展开全部
给你看一下例子:
USE [STUDB]
GO
if exists(select * from sysobjects where name='tb_stuInformation')
drop table tb_stuInformation
go
CREATE TABLE [dbo].[tb_stuInformation](
[sid] [int] IDENTITY(1,1) NOT NULL,
[sname] [varchar](8) NOT NULL,
[sex] [char](2) NOT NULL,
[sclass] [varchar](8) NOT NULL,
[snation] [varchar](8) NOT NULL,
CONSTRAINT [PK_tb_stuInformation] PRIMARY KEY CLUSTERED
(
[sid] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
USE [STUDB]
GO
if exists(select * from sysobjects where name='tb_stuInformation')
drop table tb_stuInformation
go
CREATE TABLE [dbo].[tb_stuInformation](
[sid] [int] IDENTITY(1,1) NOT NULL,
[sname] [varchar](8) NOT NULL,
[sex] [char](2) NOT NULL,
[sclass] [varchar](8) NOT NULL,
[snation] [varchar](8) NOT NULL,
CONSTRAINT [PK_tb_stuInformation] PRIMARY KEY CLUSTERED
(
[sid] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
第一个值是int类型的,不用加单引号
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询