Partager via


Exécuter le script de migration 7 pour comparer les captures instantanées de validation de données Project Server 2003 et Project Server 2007

 

S’applique à : Project Server 2010

Dernière rubrique modifiée : 2012-03-16

Le script de migration 7 compare la capture instantanée des données de prémigration de Microsoft Office Project Server 2003 (créée par le script 3) à la capture instantanée des données de post-migration de Microsoft Office Project Server 2007 (créée par le script 5). Le script 7 effectue les tâches suivantes :

  1. Il liste les projets non migrés vers la base de données provisoire (projets existants au sein de Project Server 2003 mais absents de la base de données publiée de Office Project Server 2007).

  2. Il liste les noms de projets distincts présentant des différences dans des champs spécifiques.

  3. Il liste les tâches et noms de projets distincts présentant des différences dans des champs spécifiques.

Ce script définit des variables pour les champs Travail, Durée et Coût des projets et des tâches. Les variables servent à déterminer les différences de plusieurs champs qui sont soit supérieurs à la marge d’erreur positive, soit inférieurs à la marge d’erreur négative (mesure en pourcentage). Cette fonctionnalité permet à l’utilisateur d’ignorer les différences situées au sein de la marge d’erreur et de se concentrer sur les différences significatives.

Avertissement

Ce script fait partie de plusieurs scripts de post-migration inclus dans l’environnement de migration virtuel Project Server. Bien que l’exécution des scripts soit facultative, elle est fortement recommandée pour faciliter la détection des problèmes susceptibles de perturber le bon déroulement de la migration de vos données. Pour plus d’informations sur les scripts de post-migration disponibles, voir Environnement de migration virtuel Project Server : exécuter les scripts de post-migration (facultatif).

Pour exécuter le script 7

  1. Sur le Bureau de l’environnement de migration virtuel, cliquez sur Démarrer le processus de migration. Ceci ouvre une fenêtre de l’Explorateur Windows qui affiche le contenu du lecteur E:.

  2. Dans l’Explorateur Windows, double-cliquez sur le dossier suivant :

    • Si vous avez une base de données, ouvrez le dossier Migrate_Proj_2003_Single_DB.

    • Si vous avez des bases de données Project Server 2003 fractionnées, ouvrez Migrate_Proj_2003_Split_DB.

  3. Ouvrez le dossier des scripts de vérification, puis cliquez sur VME Script 7.sql. Cela entraîne l’ouverture de SQL Server Management Studio et l’affichage du script 7.

  4. Cliquez sur Exécuter pour exécuter le script.

  5. Consultez les résultats.

Important

Les résultats du script peuvent indiquer une fausse disparité d’identificateurs de tâche entre les tâches Project Server 2003 et Office Project Server 2007. Par exemple, lorsque vous comparez une tâche qui a été migrée depuis Project Server 2003 vers Office Project Server 2007, l’identificateur TASK_UID Project Server 2003 peut ne pas correspondre à l’identificateur TASK_ID Project Server 2003. En effet, les tâches peuvent obtenir des UID et ID qui ne correspondent pas dans Project Server 2003 lors de l’insertion, de la suppression ou du déplacement de tâches dans un projet. Si les résultats du script 7 montrent ces types de disparités, vous pouvez vérifier si les valeurs migrées sont correctes en comparant les valeurs indiquées dans Microsoft Project Professional 2010 entre votre environnement source et votre environnement migré. Si ces valeurs correspondent, les disparités indiquées par le script 7 sont fausses et vous pouvez les ignorer.

Script 7

Le script 7 contient le code suivant :

/*---------------------------------------------------------------------------------------
-- Script A7: Compares data validation snapshot between Pre-Migration (2003) and Post-Migration (2007) databases ----
-- This script:
-- 1. Compares the project data before and after the migration from Project Server 2003 SP3 to Project Server 2003 SP2
-- 2. List the projects not migrated to the draft database (existing in Project Server 2003 but missing in 2007)
   3. List the distinct project names with differences on specific fields
   4. List the distinct project names and tasks with differences on specific fields
   5. Adjust to parameters by using variables containing the % of difference between the Project 2003 and 2007 data
   
   This script requires you to set the database names of the Migration Validation Database.
   By default we have: USE ProjectServer_Migration_Data_Validation
   
   This script allows you to set variables for the Work, Duration and Cost fields of the projects and tasks. The variables are used 
   to expose the differences on various fields which are either greater to the positive margin of error (in %) or smaller than 
   the negative margin of error (in %). This feature allows the user to ignore the differences which are within the margin of error, 
   and focus on the significant differences.
   
-- ************************************************ BEGIN DECLARE VARIABLES ************************************************ --
*/
DECLARE @Work_Ratio decimal(18,4);-- Variable to set the Work Ratio differences in % (+ or -) which are tolerable
DECLARE @Duration_Ratio decimal(18,4);-- Variable to set the Duration Ratio differences in % (+ or -) which are tolerable
DECLARE @Cost_Ratio decimal(18,4);-- Variable to set the Cost Ratio differences in % (+ or -) which are tolerable

--------------------------------------------  END DECLARE VARIABLES  ---------------------------------------------

-- *********************************************** BEGIN SET VARIABLE VALUES *********************************************** --

SET @Work_Ratio = 0.005;-- Set the Work Ratio to a % to ignore differences (+ or -) which are tolerable
SET @Duration_Ratio = 0.005;-- Set local variable to a % to ignore differences (+ or -) which are tolerable
SET @Cost_Ratio = 0.005;-- Set local variable to a % to ignore differences (+ or -) which are tolerable

------------------------------------------  END SET VARIABLE VALUES  -----------------------------------------------
  
 ----------------------------------------------------------------------------------------------*/

USE ProjectServer_Migration_Data_Validation

--------------------------------------------------
-- List of Projects not migrated to the Project Server 2007 Draft database
--------------------------------------------------
select distinct [Project Name] AS 'List of Projects not migrated to the Project Server 2007 Draft database' 
from Migration_PS2003_Data_Validation_Snapshot 
where replace([Project Name], '.Published', '_Published') not in 
(select [Project Name] from Migration_PS2007_Data_Validation_Snapshot)
and Migration_PS2003_Data_Validation_Snapshot.[proj type] in (0,1,100)


--------------------------------------------------
-- Projects with different start date
--------------------------------------------------
select 
Migration_PS2003_Data_Validation_Snapshot.[Project Name] 
AS 'List of Projects with Project Start Dates not Matching After Migration', 
datediff(day, 
Migration_PS2003_Data_Validation_Snapshot.[Proj Start Date],
Migration_PS2007_Data_Validation_Snapshot.[Proj Start Date]) 
as Difference_in_Days
from 
Migration_PS2003_Data_Validation_Snapshot, Migration_PS2007_Data_Validation_Snapshot WITH (NOLOCK)
where
REPLACE(Migration_PS2003_Data_Validation_Snapshot.[Project Name],'.Published','_Published') 
= Migration_PS2007_Data_Validation_Snapshot.[Project Name] and 
Migration_PS2003_Data_Validation_Snapshot.[Proj Start Date] 
<> Migration_PS2007_Data_Validation_Snapshot.[Proj Start Date]
order by Difference_in_Days



--------------------------------------------------
-- Projects with different finish date
--------------------------------------------------
select distinct
Migration_PS2003_Data_Validation_Snapshot.[Project Name] 
AS 'List of Projects with Project Finish Dates not Matching After Migration', 
Migration_PS2003_Data_Validation_Snapshot.[Proj Finish Date], 
Migration_PS2007_Data_Validation_Snapshot.[Proj Finish Date],
datediff(day, 
Migration_PS2003_Data_Validation_Snapshot.[Proj Finish Date],Migration_PS2007_Data_Validation_Snapshot.[Proj Finish Date]) 
as Difference_in_Days
from 
Migration_PS2003_Data_Validation_Snapshot, Migration_PS2007_Data_Validation_Snapshot --WITH (NOLOCK)
where 
REPLACE(Migration_PS2003_Data_Validation_Snapshot.[Project Name],'.Published','_Published') 
= Migration_PS2007_Data_Validation_Snapshot.[Project Name] and 
Migration_PS2003_Data_Validation_Snapshot.[Proj Finish Date] <> Migration_PS2007_Data_Validation_Snapshot.[Proj Finish Date]
order by Difference_in_Days


--------------------------------------------------
-- Projects with different Project Work
--------------------------------------------------
select distinct
Migration_PS2003_Data_Validation_Snapshot.[Project Name]
AS 'List of Projects with Project Work not Matching After Migration'
, Migration_PS2003_Data_Validation_Snapshot.[Task Work] AS 'Project 2003 Work'
, Migration_PS2007_Data_Validation_Snapshot.[Task Work] AS 'Project 2007 Work',
(Migration_PS2003_Data_Validation_Snapshot.[Task Work] 
- Migration_PS2007_Data_Validation_Snapshot.[Task Work]) as 'Work Difference'
from 
Migration_PS2003_Data_Validation_Snapshot, Migration_PS2007_Data_Validation_Snapshot --WITH (NOLOCK)
where 

REPLACE(Migration_PS2003_Data_Validation_Snapshot.[Project Name],'.Published','_Published') 
= Migration_PS2007_Data_Validation_Snapshot.[Project Name] 
and Migration_PS2003_Data_Validation_Snapshot.[Task Work] <> Migration_PS2007_Data_Validation_Snapshot.[Task Work]
and ((Migration_PS2003_Data_Validation_Snapshot.[Task Work] 
- Migration_PS2007_Data_Validation_Snapshot.[Task Work])
> ((@Work_Ratio * Migration_PS2003_Data_Validation_Snapshot.[Task Work])/100)
or
((Migration_PS2003_Data_Validation_Snapshot.[Task Work] 
- Migration_PS2007_Data_Validation_Snapshot.[Task Work])
 < ((@Work_Ratio*-1)* Migration_PS2003_Data_Validation_Snapshot.[Task Work])/100))
and Migration_PS2003_Data_Validation_Snapshot.[Task UID]  
= Migration_PS2007_Data_Validation_Snapshot.[Task ID]
and Migration_PS2003_Data_Validation_Snapshot.[Task UID]= 0
and Migration_PS2003_Data_Validation_Snapshot.[Task Type] = 
    Migration_PS2007_Data_Validation_Snapshot.[Task Type] 
and Migration_PS2007_Data_Validation_Snapshot.[Task Type] = 1
order by 'Work Difference'


--------------------------------------------------
-- Projects with different Actual Work
--------------------------------------------------
select distinct
Migration_PS2003_Data_Validation_Snapshot.[Project Name]
AS 'List of Projects with Project Actual Work not Matching After Migration'
, Migration_PS2003_Data_Validation_Snapshot.[Task Actual Work] AS 'Project 2003 Actual Work'
, Migration_PS2007_Data_Validation_Snapshot.[Task Actual Work] AS 'Project 2007 Actual Work',
(Migration_PS2003_Data_Validation_Snapshot.[Task Actual Work] 
- Migration_PS2007_Data_Validation_Snapshot.[Task Actual Work]) as 'Actual Work Difference'
from 
Migration_PS2003_Data_Validation_Snapshot, Migration_PS2007_Data_Validation_Snapshot --WITH (NOLOCK)
where 

REPLACE(Migration_PS2003_Data_Validation_Snapshot.[Project Name],'.Published','_Published') 
= Migration_PS2007_Data_Validation_Snapshot.[Project Name] 
and Migration_PS2003_Data_Validation_Snapshot.[Task Actual Work] 
<> Migration_PS2007_Data_Validation_Snapshot.[Task Actual Work]
and ((Migration_PS2003_Data_Validation_Snapshot.[Task Actual Work] 
- Migration_PS2007_Data_Validation_Snapshot.[Task Actual Work])
> ((@Work_Ratio * Migration_PS2003_Data_Validation_Snapshot.[Task Actual Work])/100)
or
((Migration_PS2003_Data_Validation_Snapshot.[Task Actual Work] 
- Migration_PS2007_Data_Validation_Snapshot.[Task Actual Work])
 < ((@Work_Ratio*-1)* Migration_PS2003_Data_Validation_Snapshot.[Task Actual Work])/100))
and Migration_PS2003_Data_Validation_Snapshot.[Task UID]  
= Migration_PS2007_Data_Validation_Snapshot.[Task ID]
and Migration_PS2003_Data_Validation_Snapshot.[Task UID]= 0
and Migration_PS2003_Data_Validation_Snapshot.[Task Type] = 
    Migration_PS2007_Data_Validation_Snapshot.[Task Type] 
and Migration_PS2007_Data_Validation_Snapshot.[Task Type] = 1
order by 'Actual Work Difference'

--------------------------------------------------
-- Projects with different Remaining Work 
--------------------------------------------------
select distinct
Migration_PS2003_Data_Validation_Snapshot.[Project Name]
AS 'List of Projects with Project Remaining Work not Matching After Migration'
, Migration_PS2003_Data_Validation_Snapshot.[Task Rem Work] AS 'Project 2003 Rem Work'
, Migration_PS2007_Data_Validation_Snapshot.[Task Rem Work] AS 'Project 2007 Rem Work',
(Migration_PS2003_Data_Validation_Snapshot.[Task Rem Work] 
- Migration_PS2007_Data_Validation_Snapshot.[Task Rem Work]) as 'Rem Work Difference'
from 
Migration_PS2003_Data_Validation_Snapshot, Migration_PS2007_Data_Validation_Snapshot --WITH (NOLOCK)
where 

REPLACE(Migration_PS2003_Data_Validation_Snapshot.[Project Name],'.Published','_Published') 
= Migration_PS2007_Data_Validation_Snapshot.[Project Name] 
and Migration_PS2003_Data_Validation_Snapshot.[Task Rem Work] 
<> Migration_PS2007_Data_Validation_Snapshot.[Task Rem Work]
and ((Migration_PS2003_Data_Validation_Snapshot.[Task Rem Work] 
- Migration_PS2007_Data_Validation_Snapshot.[Task Rem Work])
> ((@Work_Ratio * Migration_PS2003_Data_Validation_Snapshot.[Task Rem Work])/100)
or
((Migration_PS2003_Data_Validation_Snapshot.[Task Rem Work] 
- Migration_PS2007_Data_Validation_Snapshot.[Task Rem Work])
 < ((@Work_Ratio*-1)* Migration_PS2003_Data_Validation_Snapshot.[Task Rem Work])/100))
and Migration_PS2003_Data_Validation_Snapshot.[Task UID]  
= Migration_PS2007_Data_Validation_Snapshot.[Task ID]
and Migration_PS2003_Data_Validation_Snapshot.[Task UID]= 0
and Migration_PS2003_Data_Validation_Snapshot.[Task Type] = 
    Migration_PS2007_Data_Validation_Snapshot.[Task Type] 
and Migration_PS2007_Data_Validation_Snapshot.[Task Type] = 1
order by 'Rem Work Difference'


--------------------------------------------------
-- Projects with different Project % Complete
--------------------------------------------------
select distinct
Migration_PS2003_Data_Validation_Snapshot.[Project Name]
AS 'List of Projects with Project Task % Complete not Matching After Migration'
, Migration_PS2003_Data_Validation_Snapshot.[Task %Complete] AS 'Project 2003 %Complete'
, Migration_PS2007_Data_Validation_Snapshot.[Task %Complete] AS 'Project 2007 %Complete',
(Migration_PS2003_Data_Validation_Snapshot.[Task %Complete] 
- Migration_PS2007_Data_Validation_Snapshot.[Task %Complete]) as '%Complete Difference'
from 
Migration_PS2003_Data_Validation_Snapshot, Migration_PS2007_Data_Validation_Snapshot --WITH (NOLOCK)
where 

REPLACE(Migration_PS2003_Data_Validation_Snapshot.[Project Name],'.Published','_Published') 
= Migration_PS2007_Data_Validation_Snapshot.[Project Name] 
and Migration_PS2003_Data_Validation_Snapshot.[Task %Complete] 
<> Migration_PS2007_Data_Validation_Snapshot.[Task %Complete]
and Migration_PS2003_Data_Validation_Snapshot.[Task UID]  
= Migration_PS2007_Data_Validation_Snapshot.[Task ID]
and Migration_PS2003_Data_Validation_Snapshot.[Task UID]= 0
and Migration_PS2003_Data_Validation_Snapshot.[Task Type] = 
    Migration_PS2007_Data_Validation_Snapshot.[Task Type] 
and Migration_PS2007_Data_Validation_Snapshot.[Task Type] = 1
order by '%Complete Difference'


--------------------------------------------------
-- Projects with different Project %Work Complete
--------------------------------------------------
select distinct
Migration_PS2003_Data_Validation_Snapshot.[Project Name]
AS 'List of Projects with Project Task %Work Complete not Matching After Migration'
, Migration_PS2003_Data_Validation_Snapshot.[Task %Work Complete] AS 'Project 2003 %Work Complete'
, Migration_PS2007_Data_Validation_Snapshot.[Task % Work Complete] AS 'Project 2007 %Work Complete',
(Migration_PS2003_Data_Validation_Snapshot.[Task %Work Complete] 
- Migration_PS2007_Data_Validation_Snapshot.[Task % Work Complete]) as '%Work Complete Difference'
from 
Migration_PS2003_Data_Validation_Snapshot, Migration_PS2007_Data_Validation_Snapshot --WITH (NOLOCK)
where 

REPLACE(Migration_PS2003_Data_Validation_Snapshot.[Project Name],'.Published','_Published') 
= Migration_PS2007_Data_Validation_Snapshot.[Project Name] 
and Migration_PS2003_Data_Validation_Snapshot.[Task %Work Complete] 
<> Migration_PS2007_Data_Validation_Snapshot.[Task % Work Complete]
and Migration_PS2003_Data_Validation_Snapshot.[Task UID]  
= Migration_PS2007_Data_Validation_Snapshot.[Task ID]
and Migration_PS2003_Data_Validation_Snapshot.[Task UID]= 0
and Migration_PS2003_Data_Validation_Snapshot.[Task Type] = 
    Migration_PS2007_Data_Validation_Snapshot.[Task Type] 
and Migration_PS2007_Data_Validation_Snapshot.[Task Type] = 1
order by '%Work Complete Difference'


----------------------------------------------------
-- Projects with different Task % Phys Work Complete
----------------------------------------------------
select distinct
Migration_PS2003_Data_Validation_Snapshot.[Project Name]
AS 'List of Projects with Project Task % Phys Work Complete not Matching After Migration'
, Migration_PS2003_Data_Validation_Snapshot.[Task % Phys Work Complete] AS 'Project 2003 % Phys Work Complete'
, Migration_PS2007_Data_Validation_Snapshot.[Task % Phys Work Complete] AS 'Project 2007 % Phys Work Complete',
(Migration_PS2003_Data_Validation_Snapshot.[Task % Phys Work Complete]  
- Migration_PS2007_Data_Validation_Snapshot.[Task % Phys Work Complete]) as '% Phys Work Complete Difference'
from 
Migration_PS2003_Data_Validation_Snapshot, Migration_PS2007_Data_Validation_Snapshot --WITH (NOLOCK)
where 

REPLACE(Migration_PS2003_Data_Validation_Snapshot.[Project Name],'.Published','_Published') 
= Migration_PS2007_Data_Validation_Snapshot.[Project Name] 
and Migration_PS2003_Data_Validation_Snapshot.[Task % Phys Work Complete] 
<> Migration_PS2007_Data_Validation_Snapshot.[Task % Phys Work Complete]
and Migration_PS2003_Data_Validation_Snapshot.[Task UID]  
= Migration_PS2007_Data_Validation_Snapshot.[Task ID]
and Migration_PS2003_Data_Validation_Snapshot.[Task UID]= 0
and Migration_PS2003_Data_Validation_Snapshot.[Task Type] = 
    Migration_PS2007_Data_Validation_Snapshot.[Task Type] 
and Migration_PS2007_Data_Validation_Snapshot.[Task Type] = 1
order by '% Phys Work Complete Difference'



--------------------------------------------------
-- Projects with different Duration
--------------------------------------------------
select distinct
Migration_PS2003_Data_Validation_Snapshot.[Project Name]
AS 'List of Projects with Project Duration not Matching After Migration'
, Migration_PS2003_Data_Validation_Snapshot.[Task Duration] AS 'Project 2003 Duration'
, Migration_PS2007_Data_Validation_Snapshot.[Task Duration] AS 'Project 2007 Duration',
(Migration_PS2003_Data_Validation_Snapshot.[Task Duration]  
- Migration_PS2007_Data_Validation_Snapshot.[Task Duration]) as 'Duration Difference'
from 
Migration_PS2003_Data_Validation_Snapshot, Migration_PS2007_Data_Validation_Snapshot --WITH (NOLOCK)
where 

REPLACE(Migration_PS2003_Data_Validation_Snapshot.[Project Name],'.Published','_Published') 
= Migration_PS2007_Data_Validation_Snapshot.[Project Name] 
and Migration_PS2003_Data_Validation_Snapshot.[Task Duration] 
<> Migration_PS2007_Data_Validation_Snapshot.[Task Duration]
and ((Migration_PS2003_Data_Validation_Snapshot.[Task Duration] 
- Migration_PS2007_Data_Validation_Snapshot.[Task Duration])
> ((@Work_Ratio * Migration_PS2003_Data_Validation_Snapshot.[Task Duration])/100)
or
((Migration_PS2003_Data_Validation_Snapshot.[Task Duration] 
- Migration_PS2007_Data_Validation_Snapshot.[Task Duration])
 < ((@Work_Ratio*-1)* Migration_PS2003_Data_Validation_Snapshot.[Task Duration])/100))
and Migration_PS2003_Data_Validation_Snapshot.[Task UID]  
= Migration_PS2007_Data_Validation_Snapshot.[Task ID]
and Migration_PS2003_Data_Validation_Snapshot.[Task UID]= 0
and Migration_PS2003_Data_Validation_Snapshot.[Task Type] = 
    Migration_PS2007_Data_Validation_Snapshot.[Task Type] 
and Migration_PS2007_Data_Validation_Snapshot.[Task Type] = 1
order by 'Duration Difference'

--------------------------------------------------
-- Projects with different Remaining Duration
--------------------------------------------------
select distinct
Migration_PS2003_Data_Validation_Snapshot.[Project Name]
AS 'List of Projects with Remaining Duration not Matching After Migration'
, Migration_PS2003_Data_Validation_Snapshot.[Task Rem Duration]  AS 'Project 2003 Rem Duration'
, Migration_PS2007_Data_Validation_Snapshot.[Task Rem Duration] AS 'Project 2007 Rem Duration',
(Migration_PS2003_Data_Validation_Snapshot.[Task Rem Duration]  
- Migration_PS2007_Data_Validation_Snapshot.[Task Rem Duration]) as 'Rem Duration Difference'
from 
Migration_PS2003_Data_Validation_Snapshot, Migration_PS2007_Data_Validation_Snapshot --WITH (NOLOCK)
where 

REPLACE(Migration_PS2003_Data_Validation_Snapshot.[Project Name],'.Published','_Published') 
= Migration_PS2007_Data_Validation_Snapshot.[Project Name] 
and Migration_PS2003_Data_Validation_Snapshot.[Task Rem Duration] 
<> Migration_PS2007_Data_Validation_Snapshot.[Task Rem Duration]
and ((Migration_PS2003_Data_Validation_Snapshot.[Task Rem Duration] 
- Migration_PS2007_Data_Validation_Snapshot.[Task Rem Duration])
> ((@Work_Ratio * Migration_PS2003_Data_Validation_Snapshot.[Task Rem Duration])/100)
or
((Migration_PS2003_Data_Validation_Snapshot.[Task Rem Duration] 
- Migration_PS2007_Data_Validation_Snapshot.[Task Rem Duration])
 < ((@Work_Ratio*-1)* Migration_PS2003_Data_Validation_Snapshot.[Task Rem Duration])/100))
and Migration_PS2003_Data_Validation_Snapshot.[Task UID]  
= Migration_PS2007_Data_Validation_Snapshot.[Task ID]
and Migration_PS2003_Data_Validation_Snapshot.[Task UID]= 0
and Migration_PS2003_Data_Validation_Snapshot.[Task Type] = 
    Migration_PS2007_Data_Validation_Snapshot.[Task Type] 
and Migration_PS2007_Data_Validation_Snapshot.[Task Type] = 1
order by 'Rem Duration Difference'

--------------------------------------------------
-- Projects with different Actual Duration
--------------------------------------------------
select distinct
Migration_PS2003_Data_Validation_Snapshot.[Project Name]
AS 'List of Projects with Project Actual Duration not Matching After Migration'
, Migration_PS2003_Data_Validation_Snapshot.[Task Actual Duration]  AS 'Project 2003 Actual Duration'
, Migration_PS2007_Data_Validation_Snapshot.[Task Actual Duration] AS 'Project 2007 Actual Duration',
(Migration_PS2003_Data_Validation_Snapshot.[Task Actual Duration]  
- Migration_PS2007_Data_Validation_Snapshot.[Task Actual Duration]) as 'Actual Duration Difference'
from 
Migration_PS2003_Data_Validation_Snapshot, Migration_PS2007_Data_Validation_Snapshot --WITH (NOLOCK)
where 

REPLACE(Migration_PS2003_Data_Validation_Snapshot.[Project Name],'.Published','_Published') 
= Migration_PS2007_Data_Validation_Snapshot.[Project Name] 
and Migration_PS2003_Data_Validation_Snapshot.[Task Actual Duration] 
<> Migration_PS2007_Data_Validation_Snapshot.[Task Actual Duration]
and ((Migration_PS2003_Data_Validation_Snapshot.[Task Actual Duration] 
- Migration_PS2007_Data_Validation_Snapshot.[Task Actual Duration])
> ((@Work_Ratio * Migration_PS2003_Data_Validation_Snapshot.[Task Actual Duration])/100)
or
((Migration_PS2003_Data_Validation_Snapshot.[Task Actual Duration] 
- Migration_PS2007_Data_Validation_Snapshot.[Task Actual Duration])
 < ((@Work_Ratio*-1)* Migration_PS2003_Data_Validation_Snapshot.[Task Actual Duration])/100))
and (Migration_PS2003_Data_Validation_Snapshot.[Task Actual Duration] 
- Migration_PS2007_Data_Validation_Snapshot.[Task Actual Duration]) != -1
and Migration_PS2003_Data_Validation_Snapshot.[Task UID]  
= Migration_PS2007_Data_Validation_Snapshot.[Task ID]
and Migration_PS2003_Data_Validation_Snapshot.[Task UID]= 0
and Migration_PS2003_Data_Validation_Snapshot.[Task Type] = 
    Migration_PS2007_Data_Validation_Snapshot.[Task Type] 
and Migration_PS2007_Data_Validation_Snapshot.[Task Type] = 1
order by 'Actual Duration Difference'


--------------------------------------------------
-- Projects with different Cost
--------------------------------------------------
select distinct
Migration_PS2003_Data_Validation_Snapshot.[Project Name]
AS 'List of Projects with Project Cost not Matching After Migration'
, Migration_PS2003_Data_Validation_Snapshot.[Task Cost]  AS 'Project 2003 Cost'
, Migration_PS2007_Data_Validation_Snapshot.[Task Cost] AS 'Project 2007 Cost',
(Migration_PS2003_Data_Validation_Snapshot.[Task Cost]  
- Migration_PS2007_Data_Validation_Snapshot.[Task Cost]) as 'Cost Difference'
from 
Migration_PS2003_Data_Validation_Snapshot, Migration_PS2007_Data_Validation_Snapshot --WITH (NOLOCK)
where 

REPLACE(Migration_PS2003_Data_Validation_Snapshot.[Project Name],'.Published','_Published') 
= Migration_PS2007_Data_Validation_Snapshot.[Project Name] 
and Migration_PS2003_Data_Validation_Snapshot.[Task Cost] 
<> Migration_PS2007_Data_Validation_Snapshot.[Task Cost]
and ((Migration_PS2003_Data_Validation_Snapshot.[Task Cost] 
- Migration_PS2007_Data_Validation_Snapshot.[Task Cost])
> ((@Work_Ratio * Migration_PS2003_Data_Validation_Snapshot.[Task Cost])/100)
or
((Migration_PS2003_Data_Validation_Snapshot.[Task Cost] 
- Migration_PS2007_Data_Validation_Snapshot.[Task Cost])
 < ((@Work_Ratio*-1)* Migration_PS2003_Data_Validation_Snapshot.[Task Cost])/100))
and Migration_PS2003_Data_Validation_Snapshot.[Task UID]  
= Migration_PS2007_Data_Validation_Snapshot.[Task ID]
and Migration_PS2003_Data_Validation_Snapshot.[Task UID]= 0
and Migration_PS2003_Data_Validation_Snapshot.[Task Type] = 
    Migration_PS2007_Data_Validation_Snapshot.[Task Type] 
and Migration_PS2007_Data_Validation_Snapshot.[Task Type] = 1
order by 'Cost Difference'

--------------------------------------------------
-- Projects with different Fixed Cost
--------------------------------------------------
select distinct
Migration_PS2003_Data_Validation_Snapshot.[Project Name]
AS 'List of Projects with Project Fixed Cost not Matching After Migration'
, Migration_PS2003_Data_Validation_Snapshot.[Task Fixed Cost]  AS 'Project 2003 Fixed Cost'
, Migration_PS2007_Data_Validation_Snapshot.[Task Fixed Cost] AS 'Project 2007 Fixed Cost',
(Migration_PS2003_Data_Validation_Snapshot.[Task Fixed Cost]  
- Migration_PS2007_Data_Validation_Snapshot.[Task Fixed Cost]) as 'Fixed Cost Difference'
from 
Migration_PS2003_Data_Validation_Snapshot, Migration_PS2007_Data_Validation_Snapshot --WITH (NOLOCK)
where 

REPLACE(Migration_PS2003_Data_Validation_Snapshot.[Project Name],'.Published','_Published') 
= Migration_PS2007_Data_Validation_Snapshot.[Project Name] 
and Migration_PS2003_Data_Validation_Snapshot.[Task Fixed Cost] 
<> Migration_PS2007_Data_Validation_Snapshot.[Task Fixed Cost]
and ((Migration_PS2003_Data_Validation_Snapshot.[Task Fixed Cost] 
- Migration_PS2007_Data_Validation_Snapshot.[Task Fixed Cost])
> ((@Work_Ratio * Migration_PS2003_Data_Validation_Snapshot.[Task Fixed Cost])/100)
or
((Migration_PS2003_Data_Validation_Snapshot.[Task Fixed Cost] 
- Migration_PS2007_Data_Validation_Snapshot.[Task Fixed Cost])
 < ((@Work_Ratio*-1)* Migration_PS2003_Data_Validation_Snapshot.[Task Fixed Cost])/100))
and Migration_PS2003_Data_Validation_Snapshot.[Task UID]  
= Migration_PS2007_Data_Validation_Snapshot.[Task ID]
and Migration_PS2003_Data_Validation_Snapshot.[Task UID]= 0
and Migration_PS2003_Data_Validation_Snapshot.[Task Type] = 
    Migration_PS2007_Data_Validation_Snapshot.[Task Type] 
and Migration_PS2007_Data_Validation_Snapshot.[Task Type] = 1
order by 'Fixed Cost Difference'

--------------------------------------------------
-- Projects with different Actual Cost
--------------------------------------------------
select distinct
Migration_PS2003_Data_Validation_Snapshot.[Project Name]
AS 'List of Projects with Project Actual Cost not Matching After Migration'
, Migration_PS2003_Data_Validation_Snapshot.[Task Actual Cost]  AS 'Project 2003 Actual Cost'
, Migration_PS2007_Data_Validation_Snapshot.[Task Actual Cost] AS 'Project 2007 Actual Cost',
(Migration_PS2003_Data_Validation_Snapshot.[Task Actual Cost]  
- Migration_PS2007_Data_Validation_Snapshot.[Task Actual Cost]) as 'Actual Cost Difference'
from 
Migration_PS2003_Data_Validation_Snapshot, Migration_PS2007_Data_Validation_Snapshot --WITH (NOLOCK)
where 

REPLACE(Migration_PS2003_Data_Validation_Snapshot.[Project Name],'.Published','_Published') 
= Migration_PS2007_Data_Validation_Snapshot.[Project Name] 
and Migration_PS2003_Data_Validation_Snapshot.[Task Actual Cost] 
<> Migration_PS2007_Data_Validation_Snapshot.[Task Actual Cost]
and ((Migration_PS2003_Data_Validation_Snapshot.[Task Actual Cost] 
- Migration_PS2007_Data_Validation_Snapshot.[Task Actual Cost])
> ((@Work_Ratio * Migration_PS2003_Data_Validation_Snapshot.[Task Actual Cost])/100)
or
((Migration_PS2003_Data_Validation_Snapshot.[Task Actual Cost] 
- Migration_PS2007_Data_Validation_Snapshot.[Task Actual Cost])
 < ((@Work_Ratio*-1)* Migration_PS2003_Data_Validation_Snapshot.[Task Actual Cost])/100))
and Migration_PS2003_Data_Validation_Snapshot.[Task UID]  
= Migration_PS2007_Data_Validation_Snapshot.[Task ID]
and Migration_PS2003_Data_Validation_Snapshot.[Task UID]= 0
and Migration_PS2003_Data_Validation_Snapshot.[Task Type] = 
    Migration_PS2007_Data_Validation_Snapshot.[Task Type] 
and Migration_PS2007_Data_Validation_Snapshot.[Task Type] = 1
order by 'Actual Cost Difference' 

--------------------------------------------------
-- Projects with different Remaining Cost
--------------------------------------------------
select distinct
Migration_PS2003_Data_Validation_Snapshot.[Project Name]
AS 'List of Projects with Project Remaining Cost not Matching After Migration'
, Migration_PS2003_Data_Validation_Snapshot.[Task Rem Cost]  AS 'Project 2003 Rem Cost'
, Migration_PS2007_Data_Validation_Snapshot.[Task Rem Cost] AS 'Project 2007 Rem Cost',
(Migration_PS2003_Data_Validation_Snapshot.[Task Rem Cost]  
- Migration_PS2007_Data_Validation_Snapshot.[Task Rem Cost]) as 'Rem Cost Difference'
from 
Migration_PS2003_Data_Validation_Snapshot, Migration_PS2007_Data_Validation_Snapshot --WITH (NOLOCK)
where 

REPLACE(Migration_PS2003_Data_Validation_Snapshot.[Project Name],'.Published','_Published') 
= Migration_PS2007_Data_Validation_Snapshot.[Project Name] 
and Migration_PS2003_Data_Validation_Snapshot.[Task Rem Cost] 
<> Migration_PS2007_Data_Validation_Snapshot.[Task Rem Cost]
and ((Migration_PS2003_Data_Validation_Snapshot.[Task Rem Cost] 
- Migration_PS2007_Data_Validation_Snapshot.[Task Rem Cost])
> ((@Work_Ratio * Migration_PS2003_Data_Validation_Snapshot.[Task Rem Cost])/100)
or
((Migration_PS2003_Data_Validation_Snapshot.[Task Rem Cost] 
- Migration_PS2007_Data_Validation_Snapshot.[Task Rem Cost])
 < ((@Work_Ratio*-1)* Migration_PS2003_Data_Validation_Snapshot.[Task Rem Cost])/100))
and Migration_PS2003_Data_Validation_Snapshot.[Task UID]  
= Migration_PS2007_Data_Validation_Snapshot.[Task ID]
and Migration_PS2003_Data_Validation_Snapshot.[Task UID]= 0
and Migration_PS2003_Data_Validation_Snapshot.[Task Type] = 
    Migration_PS2007_Data_Validation_Snapshot.[Task Type] 
and Migration_PS2007_Data_Validation_Snapshot.[Task Type] = 1
order by 'Rem Cost Difference'

--------------------------------------------------
-- Projects with different Overtime Cost
--------------------------------------------------
select distinct
Migration_PS2003_Data_Validation_Snapshot.[Project Name]
AS 'List of Projects with Project Overtime Cost not Matching After Migration'
, Migration_PS2003_Data_Validation_Snapshot.[Task Ovt Cost]  AS 'Project 2003 Ovt Cost'
, Migration_PS2007_Data_Validation_Snapshot.[Task Ovt Cost] AS 'Project 2007 Ovt Cost',
(Migration_PS2003_Data_Validation_Snapshot.[Task Ovt Cost]  
- Migration_PS2007_Data_Validation_Snapshot.[Task Ovt Cost]) as 'Ovt Cost Difference'
from 
Migration_PS2003_Data_Validation_Snapshot, Migration_PS2007_Data_Validation_Snapshot 
where 

REPLACE(Migration_PS2003_Data_Validation_Snapshot.[Project Name],'.Published','_Published') 
= Migration_PS2007_Data_Validation_Snapshot.[Project Name] 
and Migration_PS2003_Data_Validation_Snapshot.[Task Ovt Cost] 
<> Migration_PS2007_Data_Validation_Snapshot.[Task Ovt Cost]
and ((Migration_PS2003_Data_Validation_Snapshot.[Task Ovt Cost] 
- Migration_PS2007_Data_Validation_Snapshot.[Task Ovt Cost])
> ((@Work_Ratio * Migration_PS2003_Data_Validation_Snapshot.[Task Ovt Cost])/100)
or
((Migration_PS2003_Data_Validation_Snapshot.[Task Ovt Cost] 
- Migration_PS2007_Data_Validation_Snapshot.[Task Ovt Cost])
 < ((@Work_Ratio*-1)* Migration_PS2003_Data_Validation_Snapshot.[Task Ovt Cost])/100))
and Migration_PS2003_Data_Validation_Snapshot.[Task UID]  
= Migration_PS2007_Data_Validation_Snapshot.[Task ID]
and Migration_PS2003_Data_Validation_Snapshot.[Task UID]= 0
and Migration_PS2003_Data_Validation_Snapshot.[Task Type] = 
    Migration_PS2007_Data_Validation_Snapshot.[Task Type] 
and Migration_PS2007_Data_Validation_Snapshot.[Task Type] = 1
order by 'Ovt Cost Difference'

----------------------------------------------------------------------
/* Distinct Projects with one or more mismatch 
---------------------------------------------------------------------*/
select Migration_PS2003_Data_Validation_Snapshot.[Project Name]
AS 'List of Projects with at least one mismatch After Migration',
datediff(day, 
Migration_PS2003_Data_Validation_Snapshot.[Proj Start Date],
Migration_PS2007_Data_Validation_Snapshot.[Proj Start Date]) as Start_Date_Diff_in_Days,
datediff(day, 
Migration_PS2003_Data_Validation_Snapshot.[Proj Finish Date],
Migration_PS2007_Data_Validation_Snapshot.[Proj Finish Date]) as Finish_Date_Diff_in_Days,
(Migration_PS2003_Data_Validation_Snapshot.[Task Work] 
- Migration_PS2007_Data_Validation_Snapshot.[Task Work]) as 'Work Diff',
(Migration_PS2003_Data_Validation_Snapshot.[Task Actual Work] 
- Migration_PS2007_Data_Validation_Snapshot.[Task Actual Work]) as 'Actual Work Diff',
(Migration_PS2003_Data_Validation_Snapshot.[Task Rem Work] 
- Migration_PS2007_Data_Validation_Snapshot.[Task Rem Work]) as 'Rem Work Diff',
(Migration_PS2003_Data_Validation_Snapshot.[Task %Complete] 
- Migration_PS2007_Data_Validation_Snapshot.[Task %Complete]) as '%Complete Diff',
(Migration_PS2003_Data_Validation_Snapshot.[Task %Work Complete] 
- Migration_PS2007_Data_Validation_Snapshot.[Task % Work Complete]) as '%Work Complete Diff',
(Migration_PS2003_Data_Validation_Snapshot.[Task % Phys Work Complete]  
- Migration_PS2007_Data_Validation_Snapshot.[Task % Phys Work Complete]) as '% Phys Work Complete Diff',
(Migration_PS2003_Data_Validation_Snapshot.[Task Duration]  
- Migration_PS2007_Data_Validation_Snapshot.[Task Duration]) as 'Duration Diff',
(Migration_PS2003_Data_Validation_Snapshot.[Task Rem Duration]  
- Migration_PS2007_Data_Validation_Snapshot.[Task Rem Duration]) as 'Rem Duration Diff',
(Migration_PS2003_Data_Validation_Snapshot.[Task Actual Duration]  
- Migration_PS2007_Data_Validation_Snapshot.[Task Actual Duration]) as 'Actual Duration Diff',
(Migration_PS2003_Data_Validation_Snapshot.[Task Cost]  
- Migration_PS2007_Data_Validation_Snapshot.[Task Cost]) as 'Cost Diff',
(Migration_PS2003_Data_Validation_Snapshot.[Task Fixed Cost]  
- Migration_PS2007_Data_Validation_Snapshot.[Task Fixed Cost]) as 'Fixed Cost Diff',
(Migration_PS2003_Data_Validation_Snapshot.[Task Actual Cost]  
- Migration_PS2007_Data_Validation_Snapshot.[Task Actual Cost]) as 'Actual Cost Diff',
(Migration_PS2003_Data_Validation_Snapshot.[Task Rem Cost]  
- Migration_PS2007_Data_Validation_Snapshot.[Task Rem Cost]) as 'Rem Cost Diff',
(Migration_PS2003_Data_Validation_Snapshot.[Task Ovt Cost]  
- Migration_PS2007_Data_Validation_Snapshot.[Task Ovt Cost]) as 'Ovt Cost Diff'


from Migration_PS2003_Data_Validation_Snapshot, Migration_PS2007_Data_Validation_Snapshot
where 
replace(Migration_PS2003_Data_Validation_Snapshot.[Project Name], '.Published', '_Published') 
= Migration_PS2007_Data_Validation_Snapshot.[Project Name] and
(
Migration_PS2003_Data_Validation_Snapshot.[Proj Start Date] <> Migration_PS2007_Data_Validation_Snapshot.[Proj Start Date] or
Migration_PS2003_Data_Validation_Snapshot.[Proj Finish Date] <> Migration_PS2007_Data_Validation_Snapshot.[Proj Finish Date] 
or (Migration_PS2003_Data_Validation_Snapshot.[Task Work] <> Migration_PS2007_Data_Validation_Snapshot.[Task Work]
   and ((Migration_PS2003_Data_Validation_Snapshot.[Task Work]- Migration_PS2007_Data_Validation_Snapshot.[Task Work])
> ((@Work_Ratio * Migration_PS2003_Data_Validation_Snapshot.[Task Work])/100)
or ((Migration_PS2003_Data_Validation_Snapshot.[Task Work] - Migration_PS2007_Data_Validation_Snapshot.[Task Work])
 < ((@Work_Ratio*-1)* Migration_PS2003_Data_Validation_Snapshot.[Task Work])/100))) 
or (Migration_PS2003_Data_Validation_Snapshot.[Task Actual Work] <> Migration_PS2007_Data_Validation_Snapshot.[Task Actual Work]
    and ((Migration_PS2003_Data_Validation_Snapshot.[Task Actual Work]- Migration_PS2007_Data_Validation_Snapshot.[Task Actual Work])
> ((@Work_Ratio * Migration_PS2003_Data_Validation_Snapshot.[Task Actual Work])/100)
or ((Migration_PS2003_Data_Validation_Snapshot.[Task Actual Work] - Migration_PS2007_Data_Validation_Snapshot.[Task Actual Work])
 < ((@Work_Ratio*-1)* Migration_PS2003_Data_Validation_Snapshot.[Task Actual Work])/100))) 
or (Migration_PS2003_Data_Validation_Snapshot.[Task Rem Work] <> Migration_PS2007_Data_Validation_Snapshot.[Task Rem Work]
    and ((Migration_PS2003_Data_Validation_Snapshot.[Task Rem Work]- Migration_PS2007_Data_Validation_Snapshot.[Task Rem Work])
> ((@Work_Ratio * Migration_PS2003_Data_Validation_Snapshot.[Task Rem Work])/100)
or ((Migration_PS2003_Data_Validation_Snapshot.[Task Rem Work] - Migration_PS2007_Data_Validation_Snapshot.[Task Rem Work])
 < ((@Work_Ratio*-1)* Migration_PS2003_Data_Validation_Snapshot.[Task Rem Work])/100))) 
or Migration_PS2003_Data_Validation_Snapshot.[Task %Complete] <> Migration_PS2007_Data_Validation_Snapshot.[Task %Complete] 
or Migration_PS2003_Data_Validation_Snapshot.[Task %Work Complete]<> Migration_PS2007_Data_Validation_Snapshot.[Task % Work Complete]
or Migration_PS2003_Data_Validation_Snapshot.[Task % Phys Work Complete] <> Migration_PS2007_Data_Validation_Snapshot.[Task % Phys Work Complete]
or (Migration_PS2003_Data_Validation_Snapshot.[Task Duration] <> Migration_PS2007_Data_Validation_Snapshot.[Task Duration]
    and ((Migration_PS2003_Data_Validation_Snapshot.[Task Duration]- Migration_PS2007_Data_Validation_Snapshot.[Task Duration])
> ((@Work_Ratio * Migration_PS2003_Data_Validation_Snapshot.[Task Duration])/100)
or ((Migration_PS2003_Data_Validation_Snapshot.[Task Duration] - Migration_PS2007_Data_Validation_Snapshot.[Task Duration])
 < ((@Work_Ratio*-1)* Migration_PS2003_Data_Validation_Snapshot.[Task Duration])/100))) 
or (Migration_PS2003_Data_Validation_Snapshot.[Task Rem Duration] <> Migration_PS2007_Data_Validation_Snapshot.[Task Rem Duration]
    and ((Migration_PS2003_Data_Validation_Snapshot.[Task Rem Duration]- Migration_PS2007_Data_Validation_Snapshot.[Task Rem Duration])
> ((@Work_Ratio * Migration_PS2003_Data_Validation_Snapshot.[Task Rem Duration])/100)
or ((Migration_PS2003_Data_Validation_Snapshot.[Task Rem Duration] - Migration_PS2007_Data_Validation_Snapshot.[Task Rem Duration])
 < ((@Work_Ratio*-1)* Migration_PS2003_Data_Validation_Snapshot.[Task Rem Duration])/100))) 
or (Migration_PS2003_Data_Validation_Snapshot.[Task Actual Duration] <> Migration_PS2007_Data_Validation_Snapshot.[Task Actual Duration]
    and ((Migration_PS2003_Data_Validation_Snapshot.[Task Actual Duration]- Migration_PS2007_Data_Validation_Snapshot.[Task Actual Duration])
> ((@Work_Ratio * Migration_PS2003_Data_Validation_Snapshot.[Task Actual Duration])/100)
or ((Migration_PS2003_Data_Validation_Snapshot.[Task Actual Duration] - Migration_PS2007_Data_Validation_Snapshot.[Task Actual Duration])
 < ((@Work_Ratio*-1)* Migration_PS2003_Data_Validation_Snapshot.[Task Actual Duration])/100)))
or (Migration_PS2003_Data_Validation_Snapshot.[Task Cost] <> Migration_PS2007_Data_Validation_Snapshot.[Task Cost]
    and ((Migration_PS2003_Data_Validation_Snapshot.[Task Cost]- Migration_PS2007_Data_Validation_Snapshot.[Task Cost])
> ((@Work_Ratio * Migration_PS2003_Data_Validation_Snapshot.[Task Cost])/100)
or ((Migration_PS2003_Data_Validation_Snapshot.[Task Cost] - Migration_PS2007_Data_Validation_Snapshot.[Task Cost])
 < ((@Work_Ratio*-1)* Migration_PS2003_Data_Validation_Snapshot.[Task Cost])/100))) 
or (Migration_PS2003_Data_Validation_Snapshot.[Task Fixed Cost]<> Migration_PS2007_Data_Validation_Snapshot.[Task Fixed Cost]
    and ((Migration_PS2003_Data_Validation_Snapshot.[Task Fixed Cost]- Migration_PS2007_Data_Validation_Snapshot.[Task Fixed Cost])
> ((@Work_Ratio * Migration_PS2003_Data_Validation_Snapshot.[Task Fixed Cost])/100)
or ((Migration_PS2003_Data_Validation_Snapshot.[Task Fixed Cost] - Migration_PS2007_Data_Validation_Snapshot.[Task Fixed Cost])
 < ((@Work_Ratio*-1)* Migration_PS2003_Data_Validation_Snapshot.[Task Fixed Cost])/100)))
or (Migration_PS2003_Data_Validation_Snapshot.[Task Actual Cost] <> Migration_PS2007_Data_Validation_Snapshot.[Task Actual Cost]
    and ((Migration_PS2003_Data_Validation_Snapshot.[Task Actual Cost]- Migration_PS2007_Data_Validation_Snapshot.[Task Actual Cost])
> ((@Work_Ratio * Migration_PS2003_Data_Validation_Snapshot.[Task Actual Cost])/100)
or ((Migration_PS2003_Data_Validation_Snapshot.[Task Actual Cost] - Migration_PS2007_Data_Validation_Snapshot.[Task Actual Cost])
 < ((@Work_Ratio*-1)* Migration_PS2003_Data_Validation_Snapshot.[Task Actual Cost])/100)))
or (Migration_PS2003_Data_Validation_Snapshot.[Task Rem Cost] <> Migration_PS2007_Data_Validation_Snapshot.[Task Rem Cost]
    and ((Migration_PS2003_Data_Validation_Snapshot.[Task Rem Cost]- Migration_PS2007_Data_Validation_Snapshot.[Task Rem Cost])
> ((@Work_Ratio * Migration_PS2003_Data_Validation_Snapshot.[Task Rem Cost])/100)
or ((Migration_PS2003_Data_Validation_Snapshot.[Task Rem Cost] - Migration_PS2007_Data_Validation_Snapshot.[Task Rem Cost])
 < ((@Work_Ratio*-1)* Migration_PS2003_Data_Validation_Snapshot.[Task Rem Cost])/100)))
or (Migration_PS2003_Data_Validation_Snapshot.[Task Ovt Cost] <> Migration_PS2007_Data_Validation_Snapshot.[Task Ovt Cost]
and ((Migration_PS2003_Data_Validation_Snapshot.[Task Ovt Cost]- Migration_PS2007_Data_Validation_Snapshot.[Task Ovt Cost])
> ((@Work_Ratio * Migration_PS2003_Data_Validation_Snapshot.[Task Ovt Cost])/100)
or ((Migration_PS2003_Data_Validation_Snapshot.[Task Ovt Cost] - Migration_PS2007_Data_Validation_Snapshot.[Task Ovt Cost])
 < ((@Work_Ratio*-1)* Migration_PS2003_Data_Validation_Snapshot.[Task Ovt Cost])/100)))
)
and Migration_PS2003_Data_Validation_Snapshot.[Task UID]  
= Migration_PS2007_Data_Validation_Snapshot.[Task ID]
and Migration_PS2003_Data_Validation_Snapshot.[Task UID]= 0
and Migration_PS2003_Data_Validation_Snapshot.[Task Type] = 
    Migration_PS2007_Data_Validation_Snapshot.[Task Type] 
and Migration_PS2007_Data_Validation_Snapshot.[Task Type] = 1

----------------------------------------------------------------------
/* Distinct Projects and Tasks with one or more mismatch 
---------------------------------------------------------------------*/
select distinct Migration_PS2003_Data_Validation_Snapshot.[Project Name]
AS 'List of Projects and tasks with at least one mismatch after Migration',
Migration_PS2007_Data_Validation_Snapshot.[Task Name],
Migration_PS2007_Data_Validation_Snapshot.[Task ID],
Migration_PS2007_Data_Validation_Snapshot.[Task Type],
datediff(day, 
Migration_PS2003_Data_Validation_Snapshot.[Proj Start Date],
Migration_PS2007_Data_Validation_Snapshot.[Proj Start Date]) as Start_Date_Diff_in_Days,
datediff(day, 
Migration_PS2003_Data_Validation_Snapshot.[Proj Finish Date],
Migration_PS2007_Data_Validation_Snapshot.[Proj Finish Date]) as Finish_Date_Diff_in_Days,
(Migration_PS2003_Data_Validation_Snapshot.[Task Work] 
- Migration_PS2007_Data_Validation_Snapshot.[Task Work]) as 'Work Diff',
(Migration_PS2003_Data_Validation_Snapshot.[Task Actual Work] 
- Migration_PS2007_Data_Validation_Snapshot.[Task Actual Work]) as 'Actual Work Diff',
(Migration_PS2003_Data_Validation_Snapshot.[Task Rem Work] 
- Migration_PS2007_Data_Validation_Snapshot.[Task Rem Work]) as 'Rem Work Diff',
(Migration_PS2003_Data_Validation_Snapshot.[Task %Complete] 
- Migration_PS2007_Data_Validation_Snapshot.[Task %Complete]) as '%Complete Diff',
(Migration_PS2003_Data_Validation_Snapshot.[Task %Work Complete] 
- Migration_PS2007_Data_Validation_Snapshot.[Task % Work Complete]) as '%Work Complete Diff',
(Migration_PS2003_Data_Validation_Snapshot.[Task % Phys Work Complete]  
- Migration_PS2007_Data_Validation_Snapshot.[Task % Phys Work Complete]) as '% Phys Work Complete Diff',
(Migration_PS2003_Data_Validation_Snapshot.[Task Duration]  
- Migration_PS2007_Data_Validation_Snapshot.[Task Duration]) as 'Duration Diff',
(Migration_PS2003_Data_Validation_Snapshot.[Task Rem Duration]  
- Migration_PS2007_Data_Validation_Snapshot.[Task Rem Duration]) as 'Rem Duration Diff',
(Migration_PS2003_Data_Validation_Snapshot.[Task Actual Duration]  
- Migration_PS2007_Data_Validation_Snapshot.[Task Actual Duration]) as 'Actual Duration Diff',
(Migration_PS2003_Data_Validation_Snapshot.[Task Cost]  
- Migration_PS2007_Data_Validation_Snapshot.[Task Cost]) as 'Cost Diff',
(Migration_PS2003_Data_Validation_Snapshot.[Task Fixed Cost]  
- Migration_PS2007_Data_Validation_Snapshot.[Task Fixed Cost]) as 'Fixed Cost Diff',
(Migration_PS2003_Data_Validation_Snapshot.[Task Actual Cost]  
- Migration_PS2007_Data_Validation_Snapshot.[Task Actual Cost]) as 'Actual Cost Diff',
(Migration_PS2003_Data_Validation_Snapshot.[Task Rem Cost]  
- Migration_PS2007_Data_Validation_Snapshot.[Task Rem Cost]) as 'Rem Cost Diff',
(Migration_PS2003_Data_Validation_Snapshot.[Task Ovt Cost]  
- Migration_PS2007_Data_Validation_Snapshot.[Task Ovt Cost]) as 'Ovt Cost Diff'


from Migration_PS2003_Data_Validation_Snapshot, Migration_PS2007_Data_Validation_Snapshot
where 
replace(Migration_PS2003_Data_Validation_Snapshot.[Project Name], '.Published', '_Published') 
= Migration_PS2007_Data_Validation_Snapshot.[Project Name] and
(
Migration_PS2003_Data_Validation_Snapshot.[Proj Start Date] <> Migration_PS2007_Data_Validation_Snapshot.[Proj Start Date] or
Migration_PS2003_Data_Validation_Snapshot.[Proj Finish Date] <> Migration_PS2007_Data_Validation_Snapshot.[Proj Finish Date] 
or (Migration_PS2003_Data_Validation_Snapshot.[Task Work] <> Migration_PS2007_Data_Validation_Snapshot.[Task Work]
   and ((Migration_PS2003_Data_Validation_Snapshot.[Task Work]- Migration_PS2007_Data_Validation_Snapshot.[Task Work])
> ((@Work_Ratio * Migration_PS2003_Data_Validation_Snapshot.[Task Work])/100)
or ((Migration_PS2003_Data_Validation_Snapshot.[Task Work] - Migration_PS2007_Data_Validation_Snapshot.[Task Work])
 < ((@Work_Ratio*-1)* Migration_PS2003_Data_Validation_Snapshot.[Task Work])/100))) 
or (Migration_PS2003_Data_Validation_Snapshot.[Task Actual Work] <> Migration_PS2007_Data_Validation_Snapshot.[Task Actual Work]
    and ((Migration_PS2003_Data_Validation_Snapshot.[Task Actual Work]- Migration_PS2007_Data_Validation_Snapshot.[Task Actual Work])
> ((@Work_Ratio * Migration_PS2003_Data_Validation_Snapshot.[Task Actual Work])/100)
or ((Migration_PS2003_Data_Validation_Snapshot.[Task Actual Work] - Migration_PS2007_Data_Validation_Snapshot.[Task Actual Work])
 < ((@Work_Ratio*-1)* Migration_PS2003_Data_Validation_Snapshot.[Task Actual Work])/100))) 
or (Migration_PS2003_Data_Validation_Snapshot.[Task Rem Work] <> Migration_PS2007_Data_Validation_Snapshot.[Task Rem Work]
    and ((Migration_PS2003_Data_Validation_Snapshot.[Task Rem Work]- Migration_PS2007_Data_Validation_Snapshot.[Task Rem Work])
> ((@Work_Ratio * Migration_PS2003_Data_Validation_Snapshot.[Task Rem Work])/100)
or ((Migration_PS2003_Data_Validation_Snapshot.[Task Rem Work] - Migration_PS2007_Data_Validation_Snapshot.[Task Rem Work])
 < ((@Work_Ratio*-1)* Migration_PS2003_Data_Validation_Snapshot.[Task Rem Work])/100))) 
or Migration_PS2003_Data_Validation_Snapshot.[Task %Complete] <> Migration_PS2007_Data_Validation_Snapshot.[Task %Complete] 
or Migration_PS2003_Data_Validation_Snapshot.[Task %Work Complete]<> Migration_PS2007_Data_Validation_Snapshot.[Task % Work Complete]
or Migration_PS2003_Data_Validation_Snapshot.[Task % Phys Work Complete] <> Migration_PS2007_Data_Validation_Snapshot.[Task % Phys Work Complete]
or (Migration_PS2003_Data_Validation_Snapshot.[Task Duration] <> Migration_PS2007_Data_Validation_Snapshot.[Task Duration]
    and ((Migration_PS2003_Data_Validation_Snapshot.[Task Duration]- Migration_PS2007_Data_Validation_Snapshot.[Task Duration])
> ((@Work_Ratio * Migration_PS2003_Data_Validation_Snapshot.[Task Duration])/100)
or ((Migration_PS2003_Data_Validation_Snapshot.[Task Duration] - Migration_PS2007_Data_Validation_Snapshot.[Task Duration])
 < ((@Work_Ratio*-1)* Migration_PS2003_Data_Validation_Snapshot.[Task Duration])/100))) 
or (Migration_PS2003_Data_Validation_Snapshot.[Task Rem Duration] <> Migration_PS2007_Data_Validation_Snapshot.[Task Rem Duration]
    and ((Migration_PS2003_Data_Validation_Snapshot.[Task Rem Duration]- Migration_PS2007_Data_Validation_Snapshot.[Task Rem Duration])
> ((@Work_Ratio * Migration_PS2003_Data_Validation_Snapshot.[Task Rem Duration])/100)
or ((Migration_PS2003_Data_Validation_Snapshot.[Task Rem Duration] - Migration_PS2007_Data_Validation_Snapshot.[Task Rem Duration])
 < ((@Work_Ratio*-1)* Migration_PS2003_Data_Validation_Snapshot.[Task Rem Duration])/100))) 
or (Migration_PS2003_Data_Validation_Snapshot.[Task Actual Duration] <> Migration_PS2007_Data_Validation_Snapshot.[Task Actual Duration]
    and ((Migration_PS2003_Data_Validation_Snapshot.[Task Actual Duration]- Migration_PS2007_Data_Validation_Snapshot.[Task Actual Duration])
> ((@Work_Ratio * Migration_PS2003_Data_Validation_Snapshot.[Task Actual Duration])/100)
or ((Migration_PS2003_Data_Validation_Snapshot.[Task Actual Duration] - Migration_PS2007_Data_Validation_Snapshot.[Task Actual Duration])
 < ((@Work_Ratio*-1)* Migration_PS2003_Data_Validation_Snapshot.[Task Actual Duration])/100)))
or (Migration_PS2003_Data_Validation_Snapshot.[Task Cost] <> Migration_PS2007_Data_Validation_Snapshot.[Task Cost]
    and ((Migration_PS2003_Data_Validation_Snapshot.[Task Cost]- Migration_PS2007_Data_Validation_Snapshot.[Task Cost])
> ((@Work_Ratio * Migration_PS2003_Data_Validation_Snapshot.[Task Cost])/100)
or ((Migration_PS2003_Data_Validation_Snapshot.[Task Cost] - Migration_PS2007_Data_Validation_Snapshot.[Task Cost])
 < ((@Work_Ratio*-1)* Migration_PS2003_Data_Validation_Snapshot.[Task Cost])/100))) 
or (Migration_PS2003_Data_Validation_Snapshot.[Task Fixed Cost]<> Migration_PS2007_Data_Validation_Snapshot.[Task Fixed Cost]
    and ((Migration_PS2003_Data_Validation_Snapshot.[Task Fixed Cost]- Migration_PS2007_Data_Validation_Snapshot.[Task Fixed Cost])
> ((@Work_Ratio * Migration_PS2003_Data_Validation_Snapshot.[Task Fixed Cost])/100)
or ((Migration_PS2003_Data_Validation_Snapshot.[Task Fixed Cost] - Migration_PS2007_Data_Validation_Snapshot.[Task Fixed Cost])
 < ((@Work_Ratio*-1)* Migration_PS2003_Data_Validation_Snapshot.[Task Fixed Cost])/100)))
or (Migration_PS2003_Data_Validation_Snapshot.[Task Actual Cost] <> Migration_PS2007_Data_Validation_Snapshot.[Task Actual Cost]
    and ((Migration_PS2003_Data_Validation_Snapshot.[Task Actual Cost]- Migration_PS2007_Data_Validation_Snapshot.[Task Actual Cost])
> ((@Work_Ratio * Migration_PS2003_Data_Validation_Snapshot.[Task Actual Cost])/100)
or ((Migration_PS2003_Data_Validation_Snapshot.[Task Actual Cost] - Migration_PS2007_Data_Validation_Snapshot.[Task Actual Cost])
 < ((@Work_Ratio*-1)* Migration_PS2003_Data_Validation_Snapshot.[Task Actual Cost])/100)))
or (Migration_PS2003_Data_Validation_Snapshot.[Task Rem Cost] <> Migration_PS2007_Data_Validation_Snapshot.[Task Rem Cost]
    and ((Migration_PS2003_Data_Validation_Snapshot.[Task Rem Cost]- Migration_PS2007_Data_Validation_Snapshot.[Task Rem Cost])
> ((@Work_Ratio * Migration_PS2003_Data_Validation_Snapshot.[Task Rem Cost])/100)
or ((Migration_PS2003_Data_Validation_Snapshot.[Task Rem Cost] - Migration_PS2007_Data_Validation_Snapshot.[Task Rem Cost])
 < ((@Work_Ratio*-1)* Migration_PS2003_Data_Validation_Snapshot.[Task Rem Cost])/100)))
or (Migration_PS2003_Data_Validation_Snapshot.[Task Ovt Cost] <> Migration_PS2007_Data_Validation_Snapshot.[Task Ovt Cost]
and ((Migration_PS2003_Data_Validation_Snapshot.[Task Ovt Cost]- Migration_PS2007_Data_Validation_Snapshot.[Task Ovt Cost])
> ((@Work_Ratio * Migration_PS2003_Data_Validation_Snapshot.[Task Ovt Cost])/100)
or ((Migration_PS2003_Data_Validation_Snapshot.[Task Ovt Cost] - Migration_PS2007_Data_Validation_Snapshot.[Task Ovt Cost])
 < ((@Work_Ratio*-1)* Migration_PS2003_Data_Validation_Snapshot.[Task Ovt Cost])/100)))
)
and Migration_PS2003_Data_Validation_Snapshot.[Task UID]  
= Migration_PS2007_Data_Validation_Snapshot.[Task ID]
and Migration_PS2003_Data_Validation_Snapshot.[Task Type] = 
    Migration_PS2007_Data_Validation_Snapshot.[Task Type] 
order by Migration_PS2003_Data_Validation_Snapshot.[Project Name],
Migration_PS2007_Data_Validation_Snapshot.[Task ID]