`

temporay note

 
阅读更多

declare @projectidmax int,@curprojectid int;

select @projectidmax=max(fk_project_id) from budget;

while @curprojectid<@projectidmax
begin


declare @num int;
select @num=count(*) from budget where fk_project_id=62;

declare @topstr nVARCHAR(256);
set @topstr='delete top'+str(@num-1) +' * from budget';
execute sp_executesql @topstr ;

set @curprojectid=@curprojectid+1;

end

 

\\\\\\\\\\\\\\\\\\\\\\\\\

declare @projectidmax int,@curprojectid int;

select @projectidmax=max(fk_project_id) from budget;

print @projectidmax;

set @curprojectid=1;
while @curprojectid<@projectidmax
begin


declare @num int;
select @num=count(*) from budget where fk_project_id=@curprojectid;

declare @topstr nVARCHAR(256);
set @topstr='delete top '+str(@num-1) +' from budget where fk_project_id='+str(@curprojectid);
execute sp_executesql @topstr ;

set @curprojectid=@curprojectid+1;

end

 

 

---------------------------

 

 

SELECT DISTINCT TEAM.FK_DIVISION_ID
FROM TEAM INNER JOIN
      MEMBERRESOURCE ON 
      TEAM.TEAM_ID = MEMBERRESOURCE.FK_TEAM_ID INNER JOIN
      RESOURCE_ASSIGN ON 
      MEMBERRESOURCE.MEMBERRESOURCE_ID = RESOURCE_ASSIGN.FK_MEMBERRESOURCE_ID

while

SELECT TOP 1 EFFORT_ESTIMATION_ID
FROM dbo.EFFORT_ESTIMATION
WHERE (FK_BUDGET_ID IN
          (SELECT BUDGET_ID 
         FROM dbo.BUDGET
         WHERE (FK_PROJECT_ID = 108) AND (IS_IN_PROCESS = 1))) AND 
      (FK_DIVISION_ID = (SELECT FROM RESOURCE))))

update RESOURCE_ASSIGN set FK_EFFORT_ESTIMATION_ID=() WHERE 

END

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics