数据库查询分析器,请各位高人看看哪里出错了!小弟感谢感谢!!!!!
发布网友
发布时间:2022-04-14 12:55
我来回答
共2个回答
热心网友
时间:2022-04-14 14:25
你字段全都是not null,而且又不指定default值,但很多insert又不给字段赋值,这样肯定不行的啦(要所有字段都赋值或指定default默认值)。初步帮你改了下:
use sales
go
create table sell_order
(order_id1 bigint not null identity(1,2),
send_date datetime not null,
custom_id char(3) not null,
order_date datetime not null,
goods_id char(3) not null,
goods_number char(3) not null,
employee_id char(2) not null,
discount decimal(4,2) not null,
discounttype varchar(40) not null,
trans_id char(2) not null)
go
alter table sell_order drop column send_date
go
sp_help sell_order
go
alter table sell_order add 发货日期 datetime not null default ''
go
sp_help sell_order
go
insert sell_order
(custom_id,order_date,goods_id,goods_number,employee_id,discount,discounttype,trans_id)
values('99','2006/2/26','135','30','16','0.95','普通','')
go
alter table sell_order add reach_date datetime not null default '',cost_money decimal not null default 0
go
insert sell_order
(custom_id,order_date,goods_id,goods_number,employee_id,discount,discounttype,trans_id)
values('6','2005/10/10','26','200','02','0.8','普通','')
go
insert sell_order
(trans_id,order_date,reach_date,cost_money,discount,employee_id,goods_number,goods_id,custom_id,discounttype)
values('10','2005/12/1','2005/12/12','200000',0,'','','','','')
go
update sell_order
set employee_id=29
where employee_id='15'and cost_money is null
go
update sell_order
set discounttype='vip',discount=discount*0.9
where custom_id='100'and cost_money is null
go
delete from sell_order
where order_date='2006/1/1'
go
select * from sell_order
热心网友
时间:2022-04-14 15:43
where order_date in
(select order_date
from order_date='2006/1/1'
select from sell_order )
其他的没有看,你一句句的试一下,不就知道在哪里错了。晕倒。