- 浏览: 50753 次
- 性别:
- 来自: 南京
文章分类
最新评论
Add two column set default value for table field property set current value
ALTER TABLE dbo.BUDGET ADD IS_IN_PROCESS bit NULL, BUDGET_PLAN_STATUS nvarchar(50) NULL GO ALTER TABLE dbo.BUDGET ADD CONSTRAINT DF_BUDGET_IS_IN_PROCESS DEFAULT 1 FOR IS_IN_PROCESS
[code=java]
jjdkdd;
dddd;
[/code]
fill in the budgetPlanstatus value based on its Status field' value
update BUDGET SET BUDGET_PLAN_STATUS=STATUS WHERE IS_IN_PROCESS=1;
-----have to perfect: add case subcondition--case status="REJECTED" SET "DRAFT",CASE status=
"FROZEN" SET "APPROVED" ;
DELETE EFFORT_ESTIMATION WHERE FK_BUDGET_ID NOT IN (SELECT BUDGET_ID from budget
WHERE IS_IN_PROCESS=1 );
DELETE EXPENSE_ESTIMATION WHERE FK_BUDGET_ID NOT IN (SELECT BUDGET_ID from budget
WHERE IS_IN_PROCESS=1 );
DDD----have to perfect
ALTER TABLE dbo.MEMBERRESOURCE ADD [STARTDATE] [datetime] NULL
UPDATE MEMBERRESOURCE SET STARTDATE='2009-9-27'
ALTER TABLE MEMBERRESOURCE ALTER COLUMN STARTDATE DATETIME NOT NULL ALTER TABLE MEMBERRESOURCE ALTER COLUMN CLOSEDATE DATETIME NOT NULL
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[RESOURCE_ASSIGN]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table [dbo].[RESOURCE_ASSIGN] GO CREATE TABLE [dbo].[RESOURCE_ASSIGN] ( [RESOURCE_ASSIGN_ID] [bigint] IDENTITY (1, 1) NOT NULL , [FK_MEMBERRESOURCE_ID] [bigint] NULL , [FK_EFFORT_ESTIMATION_ID] [bigint] NULL , [MANMONTH_10] [real] NULL , [MANMONTH_11] [real] NULL , [MANMONTH_12] [real] NULL , [MANMONTH_01] [real] NULL , [MANMONTH_02] [real] NULL , [MANMONTH_03] [real] NULL , [MANMONTH_04] [real] NULL , [MANMONTH_05] [real] NULL , [MANMONTH_06] [real] NULL , [MANMONTH_07] [real] NULL , [MANMONTH_08] [real] NULL , [MANMONTH_09] [real] NULL ) ON [PRIMARY] GO
declare @projectidmax int,@curprojectid int; select @projectidmax=max(fk_project_id) from budget; set @curprojectid=1; while @curprojectid<=@projectidmax begin declare @budgetidmax int; select @budgetidmax=max(budget_id) from budget where fk_project_id=@curprojectid; update budget set IS_IN_PROCESS=1 where ((fk_project_id=@curprojectid) and (budget_id=@budgetidmax)); update budget set IS_IN_PROCESS=0 where ((fk_project_id=@curprojectid) and (budget_id<@budgetidmax));
insert into RESOURCE_ASSIGN( MANMONTH_10, MANMONTH_11, MANMONTH_12, MANMONTH_01, MANMONTH_02, MANMONTH_03, MANMONTH_04, MANMONTH_05, MANMONTH_06, MANMONTH_07, MANMONTH_08, MANMONTH_09,FK_MEMBERRESOURCE_ID, FK_EFFORT_ESTIMATION_ID ) SELECT RESOURCEASSIGNMENT.MANMONTH_10, RESOURCEASSIGNMENT.MANMONTH_11, RESOURCEASSIGNMENT.MANMONTH_12, RESOURCEASSIGNMENT.MANMONTH_01, RESOURCEASSIGNMENT.MANMONTH_02, RESOURCEASSIGNMENT.MANMONTH_03, RESOURCEASSIGNMENT.MANMONTH_04, RESOURCEASSIGNMENT.MANMONTH_05, RESOURCEASSIGNMENT.MANMONTH_06, RESOURCEASSIGNMENT.MANMONTH_07, RESOURCEASSIGNMENT.MANMONTH_08, RESOURCEASSIGNMENT.MANMONTH_09, RESOURCEASSIGNMENT.FK_MEMBERRESOURCE_ID, ( SELECT TOP 1 EFFORT_ESTIMATION_ID FROM dbo.EFFORT_ESTIMATION WHERE (EFFORT_ESTIMATION.FK_FISCALYEAR_ID=RESOURCEASSIGNMENT.FK_FISCALYEAR_ID AND FK_BUDGET_ID IN (SELECT TOP 1 BUDGET_ID FROM dbo.BUDGET WHERE (FK_PROJECT_ID = @curprojectid) AND (IS_IN_PROCESS = 1) AND (FK_DIVISION_ID = (SELECT TOP 1 FK_DIVISION_ID FROM TEAM WHERE TEAM_ID=(SELECT TOP 1 FK_TEAM_ID FROM MEMBERRESOURCE WHERE MEMBERRESOURCE.MEMBERRESOURCE_ID=RESOURCEASSIGNMENT.FK_MEMBERRESOURCE_ID))))) ) FROM RESOURCEASSIGNMENT Where fk_project_id=@curprojectid;
set @curprojectid=@curprojectid+1;
end -----have to perfect
----Resource_Assign: some FK_EFFORT_ESTIMATION_ID IS NULL
FIND OUT THE REASON
-----perhaps : forecast?
UPDATE EFFORT_ESTIMATION SET IS_ACTUAL=0,INITIAL_TOTAL_MANMONTH=MONTH_10+MONTH_11+MONTH_12+MONTH_1+MONTH_2+MONTH_3+MONTH_4+MONTH_5+MONTH_6+MONTH_7+MONTH_8+MONTH_9 WHERE IS_ACTUAL=1; UPDATE EFFORT_ESTIMATION SET FK_WORKPACKAGE_ID=27 WHERE FK_WORKPACKAGE_ID IS NULL;(In fact, can merge into first sql)
ALTER TABLE dbo.EFFORT_ESTIMATION ADD IS_ALIGNED bit NULL;
ALTER TABLE dbo.EFFORT_ESTIMATION ADD CONSTRAINT DF_EFFORT_ESTIMATION_IS_ALIGNED DEFAULT 0 FOR IS_ALIGNED
UPDATE EFFORT_ESTIMATION SET IS_ALIGNED = 0;
update BUDGET SET BUDGET_PLAN_STATUS=case when STATUS='FROZEN' then 'APPROVED' ELSE 'DRAFT' END
after ResourceAssignment--->Resource_Assign,
if Fk_effort_estimation_id=null,delete the Resource_Assign;
delete all IS_IN_PROCESSING=0 from Budget(also effort and expense)---no dirty data can avoid some hidden trouble or danger due to incomplete and unprecise condition control;
---------------------------------------------------------------------------------------------------------------------------------
SELECT RESOURCEASSIGNMENT.MANMONTH_10,
RESOURCEASSIGNMENT.MANMONTH_11, RESOURCEASSIGNMENT.MANMONTH_12,
RESOURCEASSIGNMENT.MANMONTH_01, RESOURCEASSIGNMENT.MANMONTH_02,
RESOURCEASSIGNMENT.MANMONTH_03, RESOURCEASSIGNMENT.MANMONTH_04,
RESOURCEASSIGNMENT.MANMONTH_05, RESOURCEASSIGNMENT.MANMONTH_06,
RESOURCEASSIGNMENT.MANMONTH_07, RESOURCEASSIGNMENT.MANMONTH_08,
RESOURCEASSIGNMENT.MANMONTH_09,
RESOURCEASSIGNMENT.FK_MEMBERRESOURCE_ID,
EFFORT_ESTIMATION.EFFORT_ESTIMATION_ID
FROM RESOURCEASSIGNMENT LEFT OUTER JOIN
BUDGET ON
BUDGET.FK_PROJECT_ID = RESOURCEASSIGNMENT.FK_PROJECT_ID LEFT OUTER JOIN
EFFORT_ESTIMATION ON
EFFORT_ESTIMATION.FK_BUDGET_ID = BUDGET.BUDGET_ID ------have to correct1
SELECT BUDGET.NAME, PROJECT.NAME AS PROJECT_NAME,
PROJECT.INTERNAL_ORDER_NUMBER, PROJECT.PROJECT_ID
FROM BUDGET left JOIN
PROJECT ON BUDGET.FK_PROJECT_ID = PROJECT.PROJECT_ID
WHERE (PROJECT.STATUS = 'IN_PROCESS') AND (BUDGET.IS_IN_PROCESS = 1)
GROUP BY BUDGET.NAME, PROJECT.NAME, PROJECT.INTERNAL_ORDER_NUMBER,
PROJECT.PROJECT_ID
ORDER BY PROJECT.PROJECT_ID------have to correct1
SELECT *, BUDGET.IS_IN_PROCESS AS Expr1, EFFORT_ESTIMATION.EFFORT_ESTIMATION_ID AS Expr2, RESOURCEASSIGNMENT.FK_MEMBERRESOURCE_ID AS Expr3 FROM RESOURCEASSIGNMENT INNER JOIN BUDGET ON RESOURCEASSIGNMENT.FK_PROJECT_ID = BUDGET.FK_PROJECT_ID INNER JOIN EFFORT_ESTIMATION ON BUDGET.BUDGET_ID = EFFORT_ESTIMATION.FK_BUDGET_ID AND RESOURCEASSIGNMENT.FK_FISCALYEAR_ID = EFFORT_ESTIMATION.FK_FISCALYEAR_ID WHERE (BUDGET.IS_IN_PROCESS = 1) SELECT *, BUDGET.IS_IN_PROCESS AS Expr1, EFFORT_ESTIMATION.EFFORT_ESTIMATION_ID AS Expr2, RESOURCEASSIGNMENT.FK_MEMBERRESOURCE_ID AS Expr3, TEAM.FK_DIVISION_ID AS Expr4, EFFORT_ESTIMATION.FK_DIVISION_ID AS Expr5 FROM RESOURCEASSIGNMENT INNER JOIN BUDGET ON RESOURCEASSIGNMENT.FK_PROJECT_ID = BUDGET.FK_PROJECT_ID INNER JOIN EFFORT_ESTIMATION ON BUDGET.BUDGET_ID = EFFORT_ESTIMATION.FK_BUDGET_ID AND RESOURCEASSIGNMENT.FK_FISCALYEAR_ID = EFFORT_ESTIMATION.FK_FISCALYEAR_ID INNER JOIN MEMBERRESOURCE ON RESOURCEASSIGNMENT.FK_MEMBERRESOURCE_ID = MEMBERRESOURCE.MEMBERRESOURCE_ID INNER JOIN TEAM ON MEMBERRESOURCE.FK_TEAM_ID = TEAM.TEAM_ID AND EFFORT_ESTIMATION.FK_DIVISION_ID = TEAM.FK_DIVISION_ID WHERE (BUDGET.IS_IN_PROCESS = 1)
SELECT TOP 1 EFFORT_ESTIMATION_ID FROM dbo.EFFORT_ESTIMATION WHERE (FK_BUDGET_ID IN (SELECT BUDGET_ID AS Expr1 FROM dbo.BUDGET WHERE (FK_PROJECT_ID = 108) AND (IS_IN_PROCESS = 1))) AND (FK_DIVISION_ID = 5)
发表评论
-
PRT maintainence
2015-09-23 20:33 0jjjeeee -
Migration Prepration & Notice
2011-07-28 10:25 0Problem1: some ee=0 should d ... -
BUDGET & FY_BUDGET_W 一起处理
2011-07-12 13:54 714Version 1 declare @budgetI ... -
BUDGET,FY_BUDGET_W
2011-07-08 13:48 0Version1: SELECT ee.*, BUDGE ... -
FY_Budget_W
2011-07-07 15:46 627version1: declare @budgetIdmax ... -
Set IS_ALIGNED='1' for EEs of all budgets in process&Delete sw's RS
2011-04-15 13:31 641Final sql script version : ... -
Align Traffic light //Batch update EffortEstimation set IS_ALIGNED value =1 or 0
2011-04-14 15:04 0string effsAligned = (p ... -
你看错了吧?!
2011-04-13 10:12 686SELECT BUDGET.BUDGET_ID, BUDGET ... -
DataMigration script
2011-03-24 11:14 9741. not keep the budget plan his ... -
temp store
2011-03-18 15:14 0SELECT RESOURCEASSIGNMENT.RESOU ... -
temporay note
2011-03-04 16:04 752declare @projectidmax int,@curp ... -
Delete Script
2011-03-04 15:16 724declare @projectidmax int,@curp ... -
Delete Top n-1 from a groud of records of a table
2011-03-04 14:35 710Test successfully! decla ... -
Import data from ResourceAssignment into Resource_Assign
2011-03-04 14:29 930insert into RESOURCE_ASSIGN( MA ...
相关推荐
《jQuery Migrate 3.0.0:解决版本迁移中的兼容问题》 jQuery Migrate 是一个专门为了解决jQuery不同版本间兼容性问题而设计的插件。在标题中提到的"jquery-migrate-3.0.0.zip",是这个插件的一个特定版本,即3.0.0...
《jQuery Migrate 3.4 版本详解》 jQuery Migrate 是一个插件,它的主要目的是帮助开发者平滑地过渡到较新版本的 jQuery,解决老版本代码在新版本中可能遇到的兼容性问题。在jQuery Migrate 3.4.0版本中,我们看到...
使用`php artisan migrate:make create_resulttable`命令,可以创建一个新迁移文件,用于创建名为`resulttable`的表。这个文件将包含两个方法:`up`和`down`。`up`方法用于执行数据库变更,而`down`方法则用于回滚...
Migrate 有两个版本。jquery-migrate-1.4.1版本将帮助您将 1.9 之前的 jQuery 代码更新到 jQuery 1.9 到 3.0。 jquery-migrate-3.4.0版本将帮助您更新代码以在 jQuery 3.0 或更高版本上运行。 jQuery Migrate是应用...
**jQuery Migrate插件详解** `jquery-migrate-1.2.1.js` 文件是jQuery的一个辅助工具,它主要用于帮助开发者解决在升级到较新版本的jQuery时可能遇到的向后兼容性问题。这个插件的主要目的是为了警告开发者那些在新...
《jQuery Migrate 3.0.0:修复与兼容性的智慧选择》 在Web开发领域,jQuery库以其简洁易用的API和强大的功能,一直以来都是开发者们的首选工具。然而,随着浏览器的更新换代和HTML5标准的普及,一些旧版jQuery的...
`jQuery Migrate` 是一个非常重要的工具,尤其对于那些依赖旧版 jQuery 功能或插件的开发者来说。在本文中,我们将深入探讨 `jQuery Migrate 1.2.1.min.js` 的作用、如何解决 `jQuery` 和 `jqPrint` 兼容性问题,...
《jQuery Migrate插件详解与应用》 在Web开发领域,jQuery是一款广泛使用的JavaScript库,它简化了HTML文档遍历、事件处理、动画以及Ajax交互等任务。然而,随着技术的发展,jQuery也在不断迭代更新,新版本可能会...
Go-migrate是一个强大的开源库,专为处理Golang应用的数据库迁移而设计。它支持多种主流数据库系统,包括MySQL、PostgreSQL、Cassandra和SQLite,这使得它成为一个灵活且跨平台的解决方案。 首先,让我们详细了解Go...
**Laravel 开发 - 元数据管理:laravel-metable** 在 Laravel 框架中,我们经常需要处理模型的额外信息,这些信息可能不是数据库表中的固定字段,而是随着业务需求变化而增加的一些动态属性。laravel-metable 是一...
《代码迁移工具:gpt-migrate深度解析》 在当今快速发展的信息技术领域,代码迁移已成为开发者面临的一项常见任务。为了适应技术更新换代或者优化项目结构,开发人员常常需要将代码从一个框架或编程语言迁移到另一...
jQuery 版本之间有区别 比如1 9版本对于 live die toggle sub $ browser 等等都已经不支持了 在不改变你网站代码的同时 要使用 1 9 之后的版本 你需要使用 jQuery migrate(转移 过度) 所以jquery migrat 就是一个...
django.db.utils.OperationalError: (1050, "Table 'xxx' already exists") 要处理这种情况,如果是数据表都已经存在了,在migrate时直接使用 –fake-initial 来处理 python manage.py migrate –fake-initial 如果...
**jQuery Migrate插件详解** 在JavaScript开发领域,jQuery是一个广泛应用的库,它极大地简化了DOM操作、事件处理和Ajax交互。然而,随着jQuery的版本更新,为了保持库的性能和现代化,一些旧的API和功能被废弃。这...
jQuery版本迁移辅助插件,如果您使用的低版本jQuery改为高版本后出现错误,可以试试这个插件。用来检测和恢复在jQuery1.9版本中已删除或已过时的API。jquery-migrate-1.2.1.js,jquery-migrate-1.2.1.min.js
最新版jquery-migrate-1.3.0.js的jquery代码迁移工具,支持jquery3.0+版本!!