1.Create table temp
2.declare cursor for distinct item
3.while fetch itemname
4.alter table add column itemname char(4)(using dynamic SQL)
5.update/insert(first time) temp itemname= select
请考虑以上描述,test...
2.declare cursor for distinct item
3.while fetch itemname
4.alter table add column itemname char(4)(using dynamic SQL)
5.update/insert(first time) temp itemname= select
请考虑以上描述,test...
可以建立科目表,并对科目表和学生成绩表作关联查询。btw:什么是透视表????????????
先读出有多少科目,动态生成CASE,把学生成绩按科目分类,然后,
再在综合起来,通过EXEC执行。无需临时表、cursor。
谢谢各位的帮助!