sql语法错误

dongliyingtodalia dongliyingtodalia 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
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'。
语句已终止。
...全文

相关推荐

评论 4
收藏 已收藏
分享
返回顶部
dongliyingtodalia
MS-SQL Server 34,876 成员 254,635 内容