首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > SQL Server >

sql语法异常

2012-05-24 
sql语法错误sql 语法错误,可是不知道哪里错了,帮姐瞧瞧吧,谢谢了表的设计如下:--订单表create table order

sql语法错误
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'。
语句已终止。

[解决办法]
货到付到改为货到付款就可以了
[解决办法]

SQL code
--订单表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')
[解决办法]
payMode varchar(20) check (payMode in('货到付到','支付宝付款')) default '货到付款',

PS. 女孩子这么不认真确实不应该

热点排行