我在设置外键的时候总是出现
表‘Guestinfo’ 中的列与现存的主键或UNIQUE约束不匹配
我弄了一个下午 依然没有解决这个问题
希望高手看下
这是创建时候的代码
建立gusetroom 数据库
create database guestroom
on
(name = guestroom_dat,
filename= 'd:\data\guestroom_dat.mdf',
size = 10,
maxsize=50,
filegrowth=5)
log on
(name='guestroom_log',
filename='d:\data\guestroom_log.ldf',
size=5mb,
maxsize=25mb,
filegrowth=5mb)
建表
建立guest表
USE GUESTROOM
GO
create table guestinfo(
Cid int primary key ,
Cname char(8) not null,
Csex char (2) not null,
Cage tinyint not null ,
Cpnum char (18) not null,
Cadd varchar (50) ,
Cintime smalldatetime not null,
Cday tinyint ,
Rnum char (5) not null,
Couttime smalldatetime ,
Cdeposit int not null,
Ccost int ,
Aid int not null)
建立adminifo表
USE GUESTROOM
GO
create table Adminifo (
Aid int primary key,
Aname varchar (16) not null ,
Anima varchar (16) not null ,
Alimit char (1) not null )
建立room表
USE GUESTROOM
GO
create table Roominfo (
Rnum varchar primary key,
Rtype char (4) ,
Rprice smalldatetime ,
Rstates char (2),
Cid int not null )
表‘Guestinfo’ 中的列与现存的主键或UNIQUE约束不匹配
我弄了一个下午 依然没有解决这个问题
希望高手看下
这是创建时候的代码
建立gusetroom 数据库
create database guestroom
on
(name = guestroom_dat,
filename= 'd:\data\guestroom_dat.mdf',
size = 10,
maxsize=50,
filegrowth=5)
log on
(name='guestroom_log',
filename='d:\data\guestroom_log.ldf',
size=5mb,
maxsize=25mb,
filegrowth=5mb)
建表
建立guest表
USE GUESTROOM
GO
create table guestinfo(
Cid int primary key ,
Cname char(8) not null,
Csex char (2) not null,
Cage tinyint not null ,
Cpnum char (18) not null,
Cadd varchar (50) ,
Cintime smalldatetime not null,
Cday tinyint ,
Rnum char (5) not null,
Couttime smalldatetime ,
Cdeposit int not null,
Ccost int ,
Aid int not null)
建立adminifo表
USE GUESTROOM
GO
create table Adminifo (
Aid int primary key,
Aname varchar (16) not null ,
Anima varchar (16) not null ,
Alimit char (1) not null )
建立room表
USE GUESTROOM
GO
create table Roominfo (
Rnum varchar primary key,
Rtype char (4) ,
Rprice smalldatetime ,
Rstates char (2),
Cid int not null )