SQL 类型 约束问题
createtablecardInfo(cardIDvarchar(50)check(cardIDlike'10103576[0-9][0-9][0-9][0-9][0-...
create table cardInfo
(
cardID varchar(50) check(cardID like '1010 3576 [0-9][0-9][0-9][0-9] [0-9][0-9][0-9]' ) primary key not null,
curType money default('RMB') not null,
savingType varchar(50) check(savingType='活期' or savingType='定活两便' or savingType='定期' ) not null,
openDate dateTime default(getDate()),
openMoney money check(openMoney>=1) not null,
balance money check(balance>=1) not null,
pass int check(pass like '[0-9][0-9][0-9][0-9][0-9][0-9]') default(888888) not null,
IsReportLoss char(2) check(IsReportLoss='是' or IsReportLoss='否') default('否') not null,
customerID int not null )
go
insert into cardInfo(cardID,savingType,openMoney,balance,customerID) values('1010 3576 1234 567','活期',1000,1000,1)
出现的错误是(无法将 char 值转换为 money。该 char 值的语法有误。) 看了半天是在不知道哪里出现问题 ,求助! 展开
(
cardID varchar(50) check(cardID like '1010 3576 [0-9][0-9][0-9][0-9] [0-9][0-9][0-9]' ) primary key not null,
curType money default('RMB') not null,
savingType varchar(50) check(savingType='活期' or savingType='定活两便' or savingType='定期' ) not null,
openDate dateTime default(getDate()),
openMoney money check(openMoney>=1) not null,
balance money check(balance>=1) not null,
pass int check(pass like '[0-9][0-9][0-9][0-9][0-9][0-9]') default(888888) not null,
IsReportLoss char(2) check(IsReportLoss='是' or IsReportLoss='否') default('否') not null,
customerID int not null )
go
insert into cardInfo(cardID,savingType,openMoney,balance,customerID) values('1010 3576 1234 567','活期',1000,1000,1)
出现的错误是(无法将 char 值转换为 money。该 char 值的语法有误。) 看了半天是在不知道哪里出现问题 ,求助! 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询