sql语法错误

dongliyingtodalia 2012-05-23 11:03:36
sql 语法错误,可是不知道哪里错了,帮姐瞧瞧吧,谢谢了

表的设计如下:
--订单表
create table orders(
ordersId bigint primary key identity(1,1), -- 订单号
userId bigint constraint fk_client_id references users(userId), --说明是哪个用户下的订单
orderDate datetime default getDate(), --订单时间
payMode varchar(20) check (payMode in('货到付到','支付宝付款')) default '货到付款',
isPay bit check( isPay in(0,1)),--0表示未付款,1表示已付款
totalPrice float not null --总价格
)

sql语句 :insert into orders(userId,isPay,totalPrice) values('1','0','120')

消息 547,级别 16,状态 0,第 1 行
INSERT 语句与 CHECK 约束"CK__orders__payMode__07F6335A"冲突。该冲突发生于数据库"testdb3",表"dbo.orders", column 'payMode'。
语句已终止。
...全文
89 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
百年树人 2012-05-24
  • 打赏
  • 举报
回复
payMode varchar(20) check (payMode in('货到付到','支付宝付款')) default '货到付款',

PS. 女孩子这么不认真确实不应该
dongliyingtodalia 2012-05-24
  • 打赏
  • 举报
回复
oh,my god,实在太粗心了,这么白痴的问题,赶紧结帖
唐诗三百首 2012-05-23
  • 打赏
  • 举报
回复

--订单表
create table orders(
ordersId bigint primary key identity(1,1), -- 订单号
userId bigint constraint fk_client_id references users(userId), --说明是哪个用户下的订单
orderDate datetime default getDate(), --订单时间
payMode varchar(20) check (payMode in('货到付款','支付宝付款')) default '货到付款',
isPay bit check( isPay in(0,1)),--0表示未付款,1表示已付款
totalPrice float not null --总价格
)

insert into orders(userId,isPay,totalPrice) values('1','0','120')
人生无悔 2012-05-23
  • 打赏
  • 举报
回复
货到付到改为货到付款就可以了

34,590

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server相关内容讨论专区
社区管理员
  • 基础类社区
  • 二月十六
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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