drop table if exists test
create table test(id int not null auto_increment,name varchar(20)not null default 'name',math int null default 60,primary key (id);
insert test values(1,'liyinglin',98)
insert test values(2,'jiangshan',79)
insert test values(3,'wangjiawu',100)
insert test values(4,'xingweiqi',89)
insert test values(5,'lingsheng',61)
执行后报一下的错误:
Server: Msg 156, Level 15, State 1, Line 1
在关键字 'if' 附近有语法错误。
Server: Msg 170, Level 15, State 1, Line 2
第 2 行: 'auto_increment' 附近有语法错误。请高手指点
create table test(id int not null auto_increment,name varchar(20)not null default 'name',math int null default 60,primary key (id);
insert test values(1,'liyinglin',98)
insert test values(2,'jiangshan',79)
insert test values(3,'wangjiawu',100)
insert test values(4,'xingweiqi',89)
insert test values(5,'lingsheng',61)
执行后报一下的错误:
Server: Msg 156, Level 15, State 1, Line 1
在关键字 'if' 附近有语法错误。
Server: Msg 170, Level 15, State 1, Line 2
第 2 行: 'auto_increment' 附近有语法错误。请高手指点
解决方案 »
- 行转列的问题
- 多用戶數據表的操作問題
- 救命呀,SQL server 2005在哪里看job?
- 错误:1785 可能会导致循环或多重级联路径。请指定 ON DELETE NO ACTION 或 ON UPDATE NO ACTION,或修改其他 FORE
- 求助:关于一个触发器的功能的实现
- 使用SqlServer连接池,应用是不是就不需要使用连接池?
- 救命!内网中怎么去连不同网段的sql server?
- SQL附加数据库问题
- 急!!!!!汗!!!!!!!急!!!~~~~~~~~~~~
- 在SQL SERVER获得一张表中共有多少条记录的SQL语句怎样写?
- 求一条SQL语句
- 一个数据导入的问题,急,在线等!!!
drop table test
GO
create table test(id int Identity(1, 1) not null ,name varchar(20)not null default 'name',math int null default 60,primary key (id))
insert test values('liyinglin',98)
insert test values('jiangshan',79)
insert test values('wangjiawu',100)
insert test values('xingweiqi',89)
insert test values('lingsheng',61)
drop table [dbo].[Test]
GOCREATE TABLE [dbo].[Test] (
[id] [int] NOT NULL ,
[name] [varchar] (20) COLLATE Chinese_PRC_CI_AS NOT NULL ,
[matn] [int] NOT NULL
) ON [PRIMARY]
GOALTER TABLE [dbo].[Test] WITH NOCHECK ADD
CONSTRAINT [DF_Test_name] DEFAULT ('name') FOR [name],
CONSTRAINT [DF_Test_matn] DEFAULT (60) FOR [matn],
CONSTRAINT [PK_Test] PRIMARY KEY CLUSTERED
(
[id]
) ON [PRIMARY]
GOinsert test values(1,'liyinglin',98)
insert test values(2,'jiangshan',79)
insert test values(3,'wangjiawu',100)
insert test values(4,'xingweiqi',89)
insert test values(5,'lingsheng',61)
if exists(select * from sysobjects where name='test') drop table test
create table test(id int Identity(1, 1),name varchar(20)not null default 'name',math int null default 60,primary key (id);insert test values(1,'liyinglin',98)
insert test values(2,'jiangshan',79)
insert test values(3,'wangjiawu',100)
insert test values(4,'xingweiqi',89)
insert test values(5,'lingsheng',61)
谢谢大家了,我现在是想把这些语句插入到java里面,所以最好越简单越好,上面的代码在查询分析器里面还是有问题,大家受累再帮我看一下吧。
Server: Msg 170, Level 15, State 1, Line 2
第 2 行: ';' 附近有语法错误。
Server: Msg 208, Level 16, State 1, Line 1
对象名 'test' 无效。
create table test(id int Identity(1, 1),name varchar(20)not null default 'name',math int null default 60,primary key (id))insert test values('liyinglin',98)
insert test values('jiangshan',79)
insert test values('wangjiawu',100)
insert test values('xingweiqi',89)
insert test values('lingsheng',61)
drop table test
GO
create table test(id int Identity(1, 1) not null ,name varchar(20)not null default 'name',math int null default 60,primary key (id))
insert test values('liyinglin',98)
insert test values('jiangshan',79)
insert test values('wangjiawu',100)
insert test values('xingweiqi',89)
insert test values('lingsheng',61)
我上面寫的這個是沒有問題的,你怎麼只復制了一半?
你也可回答别人的提问,您的帐号上超过3元时,可以要求网站提现。