下面这两条SQL server 程序的语句 怎么写?

[复制链接]
查看11 | 回复2 | 2012-4-1 12:08:09 | 显示全部楼层 |阅读模式
1. Modules must now be classified as either a local module or a national module. Write the SQL that will modify the MODULE table and add a type field for this. By default all modules will need to be classified as national.
2. Write the SQL statements that will do the following
Create a temporary table called Results2008 based on the current result table structure.
Load all records from result into results2008 for assessments issued and received in 2008.
我写了一些,感觉应该是这样的,但是有错误
/*1*/
ALTER TABLE MODULE
ALTER COLUMN MODULE_TYPE CHAR(15)
SET DEFAULT 'NATIONAL'
CHECK (MODULE_TYPE= NATIONAL OR MODULE_TYPE= LOCAL)
/*2*/
SELECT *
INTO #Results2008
FROM RESULT
WHERE ( select ENROLLMENT.year from ENROLLMENT where year = 2008)大家帮我改改

回复

使用道具 举报

千问 | 2012-4-1 12:08:09 | 显示全部楼层
/*2*/错误原因:where 条件后应该跟个字段,还有“select * ”也有误,要看根据#Results2008表中有多少个字段来选择。比如:SELECT idINTO aaFROM empInfoWHERE empdept=( select deptINFO.DEPTcODE from deptINFO where ID = 4)注:“aa”表前提不存在的情况下...
回复

使用道具 举报

千问 | 2012-4-1 12:08:09 | 显示全部楼层
1.alter table module后是连接add constraint 的~~估计你错了...英文懒的看...也不太懂...2.大概可以了......
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行