sql出错求解

88391788 2015-08-07 02:01:28
use db_test
createtable xz(
base_id intidentity(1,1)primarykey,
base_bhao varchar(8)notnulldefault'00000000',
base_name varchar(20)notnull,
base_dxin numeric(18,2)notnulldefault'0.00',
base_gwei numeric(18,2)notnulldefault'0.00',
base_jshu numeric(18,2)notnulldefault'0.00',
base_zjian numeric(18,2)notnulldefault'0.00',
base_canbu numeric(18,2)notnulldefault'0.00',
base_chaibu numeric(18,2)notnulldefault'0.00',

)

insertinto xz values('20101611','测试1','500','500','500','300','20','10')
insertinto xz values('20101612','测试2','500','300','500','300','20','10')
insertinto xz values('20101613','测试3','500','400','0','300','20','10')
insertinto xz values('20101614','测试4','500','1000','500','300','20','10')
...全文
83 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
gw6328 2015-08-07
  • 打赏
  • 举报
回复
不会是 insertinto写一起了吧?
  • 打赏
  • 举报
回复
我给修改了一下:
use db_test
go

create table xz(
base_id int identity(1,1) primary key,
        base_bhao varchar(8) not null default'00000000',
base_name varchar(20) not null,
base_dxin numeric(18,2) not null default'0.00',
base_gwei numeric(18,2) not null default'0.00',
base_jshu numeric(18,2) not null default'0.00',
base_zjian numeric(18,2) not null default'0.00',
base_canbu numeric(18,2) not null default'0.00',
base_chaibu numeric(18,2) not null default'0.00'
)

insert into xz values('20101611','测试1','500','500','500','300','20','10')
insert into xz values('20101612','测试2','500','300','500','300','20','10')
insert into xz values('20101613','测试3','500','400','0','300','20','10')
insert into xz values('20101614','测试4','500','1000','500','300','20','10')
Tiger_Zhao 2015-08-07
  • 打赏
  • 举报
回复
要把除自增列之外的自动显式列出来。
insertinto xz(base_bhao,base_name,base_dxin,base_gwei,base_jshu,base_zjian,base_canbu,base_chaibu)
values('20101611','测试1','500','500','500','300','20','10')
insertinto xz(base_bhao,base_name,base_dxin,base_gwei,base_jshu,base_zjian,base_canbu,base_chaibu)
values('20101612','测试2','500','300','500','300','20','10')
insertinto xz(base_bhao,base_name,base_dxin,base_gwei,base_jshu,base_zjian,base_canbu,base_chaibu)
values('20101613','测试3','500','400','0','300','20','10')
insertinto xz(base_bhao,base_name,base_dxin,base_gwei,base_jshu,base_zjian,base_canbu,base_chaibu)
values('20101614','测试4','500','1000','500','300','20','10')

27,579

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server 应用实例
社区管理员
  • 应用实例社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧