小弟,想在新增学生的时候,插入这个学生在这个学期所要学习的内容的GUID 和初始化分数 但是不知道具体怎么写,我的思路是是使用 
insert into student_estimate_ships(GUID,FKstudentID,PKEstimateProjectID) select NEWID(),@studentid,PKEstimateProjectID from #table//@studentid 是传入存储过程的学生ID~我不知道这个参数怎么提前插入临时表
~~
临时表的创建 
create table #t ( studentid nvarchar(36),PKEstimateProjectID nvarchar(2000))我的查询PKEstimateProjectID 语句是
  select d.PKEstimateProjectID
  from estimate_project d,(  select a.PKSemesterCourseID
  from semester_course_ships a ,(  select PKCourseID
  from estimate_course where FKClassTypeID ='85d75476-d5e3-420b-a7dc-112f6f470534') b
  where a.FKCourseID = b.PKCourseID) f where d.FKSemesterCourseID =f.PKSemesterCourseID order by FKAbilityProjectID --这里获取全部的PKEstimateProjectID 
不知道怎么吧这里的PKEstimateProjectID  和上面传入的参数@studentid插入临时表~~,最后再用上面的
insert into student_estimate_ships(GUID,FKstudentID,PKEstimateProjectID) select NEWID(),@studentid,PKEstimateProjectID from #table//@studentid 是传入存储过程的学生ID~我不知道这个参数怎么提前插入临时表 插入到student_estimate_ships表~~最后的50分 还望哪位大神~~指导下 有代码~最好~小弟愚钝~~·不知道如何下手~~~~存储过程批量插入创建临时表

解决方案 »

  1.   

    INSERT INTO student_estimate_ships([GUID],FKstudentID,PKEstimateProjectID) 
    SELECT NEWID(),@studentid,d.PKEstimateProjectID 
    FROM semester_course_ships a JOIN estimate_course b 
    ON b. FKClassTypeID ='85d75476-d5e3-420b-a7dc-112f6f470534' AND a.FKCourseID = b.PKCourseID 
    JOIN  estimate_project d 
    ON d.FKSemesterCourseID =a.PKSemesterCourseID
      

  2.   

    你好,怎么插入临时表信息,一个是从SQL插入的信息 ,一个是C#后台传入的学生GUID~~怎么把这两个信息插入临时表?
      

  3.   

    最好把要处理数据库的一系列动作写成procedure,然后在c#调用。
    在线指导:
    http://item.taobao.com/item.htm?spm=686.1000925.1000774.23.nFGG8X&id=27406928729