sql执行修改列数据类型时出错

876456fyb 876456fyb 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
create database 学生成绩管理
on
(
name='学生成绩管理_data',
filename='f:\DATA\学生成绩管理_datat.mdf',
size=1,
maxsize=unlimited,
filegrowth=10%
)
log on
(
name='学生成绩管理_log',
filename='f:\DATA\学学生成绩管理_data.ldf',
size=1,
maxsize=5,
filegrowth=1

)


create table 学生表
(
学号 char(12) primary key not null,
姓名 char(8) not null,
性别 char(2) not null,
出生年月 datetime,
所在系 varchar(30)
)


create table 课程表
(
课程号 char(8) primary key not null,
课程名 varchar(30) not null,
学分 smallint not null,
任课教师 char(8)
)


create table 成绩表
(
学号 char(12) primary key not null,
课程号 char(8),
成绩 numeric(5,1)
)



--删除约束
alter table 成绩表
drop constraint 约束2

alter table 成绩表
drop constraint 约束1

ALTER TABLE 课程表 alter column 课程号 bigint




服务器: 消息 5074,级别 16,状态 8,行 1
对象 'PK__课程表__155B1B70' 依赖于 列 '课程号'。
服务器: 消息 4922,级别 16,状态 1,行 1
ALTER TABLE ALTER COLUMN 课程号 失败,因为有一个或多个对象访问此列。


求解,我是菜鸟,虚心求教。
...全文

相关推荐

评论 2
收藏 已收藏
分享
返回顶部
876456fyb
Sybase 2,598 成员 25,608 内容