Selected Report Options:
Comparison Results By Object: Procedures
Tables
Views
|
AdventureWorks – Deployment Preview |
Selected Report Options:
Comparison Results By Object: Procedures
Tables
Views
|
Differences By Object:
Procedure //[dbo].[uspGetWhereUsedProductID] (back to Summary) |
---|
Source project | Target database | ||
---|---|---|---|
1 | SET ANSI_NULLS ON | ||
2 | SET QUOTED_IDENTIFIER ON | ||
3 | GO | ||
4 | CREATE PROCEDURE [dbo].[uspGetWhereUsedProductID] | ||
5 | @StartProductID [int], | ||
6 | @CheckDate [datetime] | ||
7 | AS | ||
8 | BEGIN | ||
9 | SET NOCOUNT ON; | ||
10 | --Use recursive query to generate a multi-level Bill of Material (i.e. all level 1 components of a level 0 assembly, all level 2 components of a level 1 assembly) | ||
11 | WITH [BOM_cte]([ProductAssemblyID], [ComponentID], [ComponentDesc], [PerAssemblyQty], [StandardCost], [ListPrice], [BOMLevel], [RecursionLevel]) -- CTE name and columns | ||
12 | AS ( | ||
13 | SELECT b.[ProductAssemblyID], b.[ComponentID], p.[Name], b.[PerAssemblyQty], p.[StandardCost], p.[ListPrice], b.[BOMLevel], 0 -- Get the initial list of components for the bike assembly | ||
14 | FROM [Production].[BillOfMaterials] b | ||
15 | INNER JOIN [Production].[Product] p | ||
16 | ON b.[ProductAssemblyID] = p.[ProductID] | ||
17 | WHERE b.[ComponentID] = @StartProductID | ||
18 | AND @CheckDate >= b.[StartDate] | ||
19 | AND @CheckDate <= ISNULL(b.[EndDate], @CheckDate) | ||
20 | UNION ALL | ||
21 | SELECT b.[ProductAssemblyID], b.[ComponentID], p.[Name], b.[PerAssemblyQty], p.[StandardCost], p.[ListPrice], b.[BOMLevel], [RecursionLevel] + 1 -- Join recursive member to anchor | ||
22 | FROM [BOM_cte] cte | ||
23 | INNER JOIN [Production].[BillOfMaterials] b | ||
24 | ON cte.[ProductAssemblyID] = b.[ComponentID] | ||
25 | INNER JOIN [Production].[Product] p | ||
26 | ON b.[ProductAssemblyID] = p.[ProductID] | ||
27 | WHERE @CheckDate >= b.[StartDate] | ||
28 | AND @CheckDate <= ISNULL(b.[EndDate], @CheckDate) | ||
29 | ) | ||
30 | -- Outer select from the CTE | ||
31 | SELECT b.[ProductAssemblyID], b.[ComponentID], b.[ComponentDesc], SUM(b.[PerAssemblyQty]) AS [TotalQuantity] , b.[StandardCost], b.[ListPrice], b.[BOMLevel], b.[RecursionLevel] | ||
32 | FROM [BOM_cte] b | ||
33 | GROUP BY b.[ComponentID], b.[ComponentDesc], b.[ProductAssemblyID], b.[BOMLevel], b.[RecursionLevel], b.[StandardCost], b.[ListPrice] | ||
34 | ORDER BY b.[BOMLevel], b.[ProductAssemblyID], b.[ComponentID] | ||
35 | OPTION (MAXRECURSION 25) | ||
36 | END; | ||
37 | GO | ||
38 |
Procedure [HumanResources].[uspUpdateEmployeeHireInfo]//[HumanResources].[uspUpdateEmployeeHireInfo] (back to Summary) |
---|
Source project | Target database | ||
---|---|---|---|
1 | SET ANSI_NULLS ON | 1 | SET ANSI_NULLS ON |
2 | SET QUOTED_IDENTIFIER ON | 2 | SET QUOTED_IDENTIFIER ON |
3 | GO | 3 | GO |
4 | CREATE PROCEDURE [HumanResources].[uspUpdateEmployeeHireInfo] | 4 | CREATE PROCEDURE [HumanResources].[uspUpdateEmployeeHireInfo] |
5 | @BusinessEntityID [int], | 5 | @BusinessEntityID [int], |
6 | @JobTitle [nvarchar](100), | 6 | @JobTitle [nvarchar](50), |
7 | @HireDate [datetime], | 7 | @HireDate [datetime], |
8 | @RateChangeDate [datetime], | 8 | @RateChangeDate [datetime], |
9 | @Rate [money], | 9 | @Rate [money], |
10 | @PayFrequency [tinyint], | 10 | @PayFrequency [tinyint], |
11 | @CurrentFlag [dbo].[Flag] | 11 | @CurrentFlag [dbo].[Flag] |
12 | WITH EXECUTE AS CALLER | 12 | WITH EXECUTE AS CALLER |
13 | AS | 13 | AS |
14 | BEGIN | 14 | BEGIN |
15 | SET NOCOUNT ON; | 15 | SET NOCOUNT ON; |
16 | BEGIN TRY | 16 | BEGIN TRY |
17 | BEGIN TRANSACTION; | 17 | BEGIN TRANSACTION; |
18 | UPDATE [HumanResources].[Employee] | 18 | UPDATE [HumanResources].[Employee] |
19 | SET [JobTitle] = @JobTitle | 19 | SET [JobTitle] = @JobTitle |
20 | ,[HireDate] = @HireDate | 20 | ,[HireDate] = @HireDate |
21 | ,[CurrentFlag] = @CurrentFlag | 21 | ,[CurrentFlag] = @CurrentFlag |
22 | WHERE [BusinessEntityID] = @BusinessEntityID; | 22 | WHERE [BusinessEntityID] = @BusinessEntityID; |
23 | INSERT INTO [HumanResources].[EmployeePayHistory] | 23 | INSERT INTO [HumanResources].[EmployeePayHistory] |
24 | ([BusinessEntityID] | 24 | ([BusinessEntityID] |
25 | ,[RateChangeDate] | 25 | ,[RateChangeDate] |
26 | ,[Rate] | 26 | ,[Rate] |
27 | ,[PayFrequency]) | 27 | ,[PayFrequency]) |
28 | VALUES (@BusinessEntityID, @RateChangeDate, @Rate, @PayFrequency); | 28 | VALUES (@BusinessEntityID, @RateChangeDate, @Rate, @PayFrequency); |
29 | COMMIT TRANSACTION; | 29 | COMMIT TRANSACTION; |
30 | END TRY | 30 | END TRY |
31 | BEGIN CATCH | 31 | BEGIN CATCH |
32 | -- Rollback any active or uncommittable transactions before | 32 | -- Rollback any active or uncommittable transactions before |
33 | -- inserting information in the ErrorLog | 33 | -- inserting information in the ErrorLog |
34 | IF @@TRANCOUNT > 0 | 34 | IF @@TRANCOUNT > 0 |
35 | BEGIN | 35 | BEGIN |
36 | ROLLBACK TRANSACTION; | 36 | ROLLBACK TRANSACTION; |
37 | END | 37 | END |
38 | EXECUTE [dbo].[uspLogError]; | 38 | EXECUTE [dbo].[uspLogError]; |
39 | END CATCH; | 39 | END CATCH; |
40 | END; | 40 | END; |
41 | GO | 41 | GO |
42 | 42 |
Table [dbo].[MyTable]// (back to Summary) |
---|
Source project | Target database | ||
---|---|---|---|
1 | SET ANSI_NULLS ON | ||
2 | SET QUOTED_IDENTIFIER ON | ||
3 | |||
4 | GO | ||
5 | CREATE TABLE [dbo].[MyTable] ( | ||
6 | [Id] [int] NOT NULL, | ||
7 | [MyCol] [nchar](10) NOT NULL | ||
8 | ) ON [PRIMARY] | ||
9 | GO | ||
10 | ALTER TABLE [dbo].[MyTable] | ||
11 | ADD | ||
12 | CONSTRAINT [MyConstraintName2] | ||
13 | PRIMARY KEY | ||
14 | CLUSTERED | ||
15 | ([Id]) | ||
16 | ON [PRIMARY] | ||
17 | GO | ||
18 | ALTER TABLE [dbo].[MyTable] | ||
19 | ADD | ||
20 | CONSTRAINT [MyConstraintName1] | ||
21 | CHECK | ||
22 | ((1)=(2)) | ||
23 | GO | ||
24 | ALTER TABLE [dbo].[MyTable] | ||
25 | CHECK CONSTRAINT [MyConstraintName1] | ||
26 | GO | ||
27 | ALTER TABLE [dbo].[MyTable] | ||
28 | ADD | ||
29 | CONSTRAINT [DF_MyTable_MyCol] | ||
30 | DEFAULT ('') FOR [MyCol] | ||
31 | GO | ||
32 | ALTER TABLE [dbo].[MyTable] | ||
33 | ADD | ||
34 | CONSTRAINT [MyConstraintName] | ||
35 | DEFAULT ((0)) FOR [Id] | ||
36 | GO | ||
37 | ALTER TABLE [dbo].[MyTable] SET (LOCK_ESCALATION = TABLE) | ||
38 | GO | ||
39 |
Table [HumanResources].[Employee]//[HumanResources].[Employee] (back to Summary) |
---|
Source project | Target database | ||
---|---|---|---|
1 | SET ANSI_NULLS ON | 1 | SET ANSI_NULLS ON |
2 | SET QUOTED_IDENTIFIER ON | 2 | SET QUOTED_IDENTIFIER ON |
3 | 3 | ||
4 | GO | 4 | GO |
5 | CREATE TABLE [HumanResources].[Employee] ( | 5 | CREATE TABLE [HumanResources].[Employee] ( |
6 | [BusinessEntityID] [int] NOT NULL, | 6 | [BusinessEntityID] [int] NOT NULL, |
7 | [NationalIDNumber] [nvarchar](15) NOT NULL, | 7 | [NationalIDNumber] [nvarchar](15) NOT NULL, |
8 | [LoginID] [nvarchar](256) NOT NULL, | 8 | [LoginID] [nvarchar](256) NOT NULL, |
9 | [OrganizationNode] [hierarchyid] NULL, | 9 | [OrganizationNode] [hierarchyid] NULL, |
10 | [OrganizationLevel] AS ([OrganizationNode].[GetLevel]()), | 10 | [OrganizationLevel] AS ([OrganizationNode].[GetLevel]()), |
11 | [JobTitle] [nvarchar](100) NOT NULL, | 11 | [JobTitle] [nvarchar](50) NOT NULL, |
12 | [BirthDate] [date] NOT NULL, | 12 | [BirthDate] [date] NOT NULL, |
13 | [MaritalStatus] [nchar](1) NOT NULL, | 13 | [MaritalStatus] [nchar](1) NOT NULL, |
14 | [Gender] [nchar](1) NOT NULL, | 14 | [Gender] [nchar](1) NOT NULL, |
15 | [HireDate] [date] NOT NULL, | 15 | [HireDate] [date] NOT NULL, |
16 | [SalariedFlag] [dbo].[Flag] NOT NULL, | 16 | [SalariedFlag] [dbo].[Flag] NOT NULL, |
17 | [VacationHours] [smallint] NOT NULL, | 17 | [VacationHours] [smallint] NOT NULL, |
18 | [SickLeaveHours] [smallint] NOT NULL, | 18 | [SickLeaveHours] [smallint] NOT NULL, |
19 | [CurrentFlag] [dbo].[Flag] NOT NULL, | 19 | [CurrentFlag] [dbo].[Flag] NOT NULL, |
20 | [rowguid] [uniqueidentifier] NOT NULL ROWGUIDCOL, | 20 | [rowguid] [uniqueidentifier] NOT NULL ROWGUIDCOL, |
21 | [ModifiedDate] [datetime] NOT NULL | 21 | [ModifiedDate] [datetime] NOT NULL |
22 | ) ON [PRIMARY] | 22 | ) ON [PRIMARY] |
23 | GO | 23 | GO |
24 | ALTER TABLE [HumanResources].[Employee] | 24 | ALTER TABLE [HumanResources].[Employee] |
25 | ADD | 25 | ADD |
26 | CONSTRAINT [PK_Employee_BusinessEntityID] | 26 | CONSTRAINT [PK_Employee_BusinessEntityID] |
27 | PRIMARY KEY | 27 | PRIMARY KEY |
28 | CLUSTERED | 28 | CLUSTERED |
29 | ([BusinessEntityID]) | 29 | ([BusinessEntityID]) |
30 | ON [PRIMARY] | 30 | ON [PRIMARY] |
31 | GO | 31 | GO |
32 | ALTER TABLE [HumanResources].[Employee] | 32 | ALTER TABLE [HumanResources].[Employee] |
33 | ADD | 33 | ADD |
34 | CONSTRAINT [CK_Employee_BirthDate] | 34 | CONSTRAINT [CK_Employee_BirthDate] |
35 | CHECK | 35 | CHECK |
36 | ([BirthDate]>='1930-01-01' AND [BirthDate]<=dateadd(year,(-18),getdate())) | 36 | ([BirthDate]>='1930-01-01' AND [BirthDate]<=dateadd(year,(-18),getdate())) |
37 | GO | 37 | GO |
38 | ALTER TABLE [HumanResources].[Employee] | 38 | ALTER TABLE [HumanResources].[Employee] |
39 | CHECK CONSTRAINT [CK_Employee_BirthDate] | 39 | CHECK CONSTRAINT [CK_Employee_BirthDate] |
40 | GO | 40 | GO |
41 | ALTER TABLE [HumanResources].[Employee] | 41 | ALTER TABLE [HumanResources].[Employee] |
42 | ADD | 42 | ADD |
43 | CONSTRAINT [CK_Employee_Gender] | 43 | CONSTRAINT [CK_Employee_Gender] |
44 | CHECK | 44 | CHECK |
45 | (upper([Gender])='F' OR upper([Gender])='M') | 45 | (upper([Gender])='F' OR upper([Gender])='M') |
46 | GO | 46 | GO |
47 | ALTER TABLE [HumanResources].[Employee] | 47 | ALTER TABLE [HumanResources].[Employee] |
48 | CHECK CONSTRAINT [CK_Employee_Gender] | 48 | CHECK CONSTRAINT [CK_Employee_Gender] |
49 | GO | 49 | GO |
50 | ALTER TABLE [HumanResources].[Employee] | 50 | ALTER TABLE [HumanResources].[Employee] |
51 | ADD | 51 | ADD |
52 | CONSTRAINT [CK_Employee_HireDate] | 52 | CONSTRAINT [CK_Employee_HireDate] |
53 | CHECK | 53 | CHECK |
54 | ([HireDate]>='1996-07-01' AND [HireDate]<=dateadd(day,(1),getdate())) | 54 | ([HireDate]>='1996-07-01' AND [HireDate]<=dateadd(day,(1),getdate())) |
55 | GO | 55 | GO |
56 | ALTER TABLE [HumanResources].[Employee] | 56 | ALTER TABLE [HumanResources].[Employee] |
57 | CHECK CONSTRAINT [CK_Employee_HireDate] | 57 | CHECK CONSTRAINT [CK_Employee_HireDate] |
58 | GO | 58 | GO |
59 | ALTER TABLE [HumanResources].[Employee] | 59 | ALTER TABLE [HumanResources].[Employee] |
60 | ADD | 60 | ADD |
61 | CONSTRAINT [CK_Employee_MaritalStatus] | 61 | CONSTRAINT [CK_Employee_MaritalStatus] |
62 | CHECK | 62 | CHECK |
63 | (upper([MaritalStatus])='S' OR upper([MaritalStatus])='M') | 63 | (upper([MaritalStatus])='S' OR upper([MaritalStatus])='M') |
64 | GO | 64 | GO |
65 | ALTER TABLE [HumanResources].[Employee] | 65 | ALTER TABLE [HumanResources].[Employee] |
66 | CHECK CONSTRAINT [CK_Employee_MaritalStatus] | 66 | CHECK CONSTRAINT [CK_Employee_MaritalStatus] |
67 | GO | 67 | GO |
68 | ALTER TABLE [HumanResources].[Employee] | 68 | ALTER TABLE [HumanResources].[Employee] |
69 | ADD | 69 | ADD |
70 | CONSTRAINT [CK_Employee_SickLeaveHours] | 70 | CONSTRAINT [CK_Employee_SickLeaveHours] |
71 | CHECK | 71 | CHECK |
72 | ([SickLeaveHours]>=(0) AND [SickLeaveHours]<=(120)) | 72 | ([SickLeaveHours]>=(0) AND [SickLeaveHours]<=(120)) |
73 | GO | 73 | GO |
74 | ALTER TABLE [HumanResources].[Employee] | 74 | ALTER TABLE [HumanResources].[Employee] |
75 | CHECK CONSTRAINT [CK_Employee_SickLeaveHours] | 75 | CHECK CONSTRAINT [CK_Employee_SickLeaveHours] |
76 | GO | 76 | GO |
77 | ALTER TABLE [HumanResources].[Employee] | 77 | ALTER TABLE [HumanResources].[Employee] |
78 | ADD | 78 | ADD |
79 | CONSTRAINT [CK_Employee_VacationHours] | 79 | CONSTRAINT [CK_Employee_VacationHours] |
80 | CHECK | 80 | CHECK |
81 | ([VacationHours]>=(-40) AND [VacationHours]<=(240)) | 81 | ([VacationHours]>=(-40) AND [VacationHours]<=(240)) |
82 | GO | 82 | GO |
83 | ALTER TABLE [HumanResources].[Employee] | 83 | ALTER TABLE [HumanResources].[Employee] |
84 | CHECK CONSTRAINT [CK_Employee_VacationHours] | 84 | CHECK CONSTRAINT [CK_Employee_VacationHours] |
85 | GO | 85 | GO |
86 | ALTER TABLE [HumanResources].[Employee] | 86 | ALTER TABLE [HumanResources].[Employee] |
87 | ADD | 87 | ADD |
88 | CONSTRAINT [DF_Employee_CurrentFlag] | 88 | CONSTRAINT [DF_Employee_CurrentFlag] |
89 | DEFAULT ((1)) FOR [CurrentFlag] | 89 | DEFAULT ((1)) FOR [CurrentFlag] |
90 | GO | 90 | GO |
91 | ALTER TABLE [HumanResources].[Employee] | 91 | ALTER TABLE [HumanResources].[Employee] |
92 | ADD | 92 | ADD |
93 | CONSTRAINT [DF_Employee_ModifiedDate] | 93 | CONSTRAINT [DF_Employee_ModifiedDate] |
94 | DEFAULT (getdate()) FOR [ModifiedDate] | 94 | DEFAULT (getdate()) FOR [ModifiedDate] |
95 | GO | 95 | GO |
96 | ALTER TABLE [HumanResources].[Employee] | 96 | ALTER TABLE [HumanResources].[Employee] |
97 | ADD | 97 | ADD |
98 | CONSTRAINT [DF_Employee_rowguid] | 98 | CONSTRAINT [DF_Employee_rowguid] |
99 | DEFAULT (newid()) FOR [rowguid] | 99 | DEFAULT (newid()) FOR [rowguid] |
100 | GO | 100 | GO |
101 | ALTER TABLE [HumanResources].[Employee] | 101 | ALTER TABLE [HumanResources].[Employee] |
102 | ADD | 102 | ADD |
103 | CONSTRAINT [DF_Employee_SalariedFlag] | 103 | CONSTRAINT [DF_Employee_SalariedFlag] |
104 | DEFAULT ((1)) FOR [SalariedFlag] | 104 | DEFAULT ((1)) FOR [SalariedFlag] |
105 | GO | 105 | GO |
106 | ALTER TABLE [HumanResources].[Employee] | 106 | ALTER TABLE [HumanResources].[Employee] |
107 | ADD | 107 | ADD |
108 | CONSTRAINT [DF_Employee_SickLeaveHours] | 108 | CONSTRAINT [DF_Employee_SickLeaveHours] |
109 | DEFAULT ((0)) FOR [SickLeaveHours] | 109 | DEFAULT ((0)) FOR [SickLeaveHours] |
110 | GO | 110 | GO |
111 | ALTER TABLE [HumanResources].[Employee] | 111 | ALTER TABLE [HumanResources].[Employee] |
112 | ADD | 112 | ADD |
113 | CONSTRAINT [DF_Employee_VacationHours] | 113 | CONSTRAINT [DF_Employee_VacationHours] |
114 | DEFAULT ((0)) FOR [VacationHours] | 114 | DEFAULT ((0)) FOR [VacationHours] |
115 | GO | 115 | GO |
116 | ALTER TABLE [HumanResources].[Employee] | 116 | ALTER TABLE [HumanResources].[Employee] |
117 | WITH CHECK | 117 | WITH CHECK |
118 | ADD CONSTRAINT [FK_Employee_Person_BusinessEntityID] | 118 | ADD CONSTRAINT [FK_Employee_Person_BusinessEntityID] |
119 | FOREIGN KEY ([BusinessEntityID]) REFERENCES [Person].[Person] ([BusinessEntityID]) | 119 | FOREIGN KEY ([BusinessEntityID]) REFERENCES [Person].[Person] ([BusinessEntityID]) |
120 | ALTER TABLE [HumanResources].[Employee] | 120 | ALTER TABLE [HumanResources].[Employee] |
121 | CHECK CONSTRAINT [FK_Employee_Person_BusinessEntityID] | 121 | CHECK CONSTRAINT [FK_Employee_Person_BusinessEntityID] |
122 | 122 | ||
123 | GO | 123 | GO |
124 | CREATE UNIQUE NONCLUSTERED INDEX [AK_Employee_LoginID] | 124 | CREATE UNIQUE NONCLUSTERED INDEX [AK_Employee_LoginID] |
125 | ON [HumanResources].[Employee] ([LoginID]) | 125 | ON [HumanResources].[Employee] ([LoginID]) |
126 | ON [PRIMARY] | 126 | ON [PRIMARY] |
127 | GO | 127 | GO |
128 | CREATE UNIQUE NONCLUSTERED INDEX [AK_Employee_NationalIDNumber] | 128 | CREATE UNIQUE NONCLUSTERED INDEX [AK_Employee_NationalIDNumber] |
129 | ON [HumanResources].[Employee] ([NationalIDNumber]) | 129 | ON [HumanResources].[Employee] ([NationalIDNumber]) |
130 | ON [PRIMARY] | 130 | ON [PRIMARY] |
131 | GO | 131 | GO |
132 | CREATE UNIQUE NONCLUSTERED INDEX [AK_Employee_rowguid] | 132 | CREATE UNIQUE NONCLUSTERED INDEX [AK_Employee_rowguid] |
133 | ON [HumanResources].[Employee] ([rowguid]) | 133 | ON [HumanResources].[Employee] ([rowguid]) |
134 | ON [PRIMARY] | 134 | ON [PRIMARY] |
135 | GO | 135 | GO |
136 | CREATE NONCLUSTERED INDEX [IX_Employee_OrganizationLevel_OrganizationNode] | 136 | CREATE NONCLUSTERED INDEX [IX_Employee_OrganizationLevel_OrganizationNode] |
137 | ON [HumanResources].[Employee] ([OrganizationLevel], [OrganizationNode]) | 137 | ON [HumanResources].[Employee] ([OrganizationLevel], [OrganizationNode]) |
138 | ON [PRIMARY] | 138 | ON [PRIMARY] |
139 | GO | 139 | GO |
140 | CREATE NONCLUSTERED INDEX [IX_Employee_OrganizationNode] | 140 | CREATE NONCLUSTERED INDEX [IX_Employee_OrganizationNode] |
141 | ON [HumanResources].[Employee] ([OrganizationNode]) | 141 | ON [HumanResources].[Employee] ([OrganizationNode]) |
142 | ON [PRIMARY] | 142 | ON [PRIMARY] |
143 | GO | 143 | GO |
144 | ALTER TABLE [HumanResources].[Employee] SET (LOCK_ESCALATION = TABLE) | 144 | ALTER TABLE [HumanResources].[Employee] SET (LOCK_ESCALATION = TABLE) |
145 | GO | 145 | GO |
146 | 146 |
Table //[Production].[Culture] (back to Summary) |
---|
Source project | Target database | ||
---|---|---|---|
1 | SET ANSI_NULLS ON | ||
2 | SET QUOTED_IDENTIFIER ON | ||
3 | |||
4 | GO | ||
5 | CREATE TABLE [Production].[Culture] ( | ||
6 | [CultureID] [nchar](6) NOT NULL, | ||
7 | [Name] [dbo].[Name] NOT NULL, | ||
8 | [ModifiedDate] [datetime] NOT NULL | ||
9 | ) ON [PRIMARY] | ||
10 | GO | ||
11 | ALTER TABLE [Production].[Culture] | ||
12 | ADD | ||
13 | CONSTRAINT [PK_Culture_CultureID] | ||
14 | PRIMARY KEY | ||
15 | CLUSTERED | ||
16 | ([CultureID]) | ||
17 | ON [PRIMARY] | ||
18 | GO | ||
19 | ALTER TABLE [Production].[Culture] | ||
20 | ADD | ||
21 | CONSTRAINT [DF_Culture_ModifiedDate] | ||
22 | DEFAULT (getdate()) FOR [ModifiedDate] | ||
23 | GO | ||
24 | CREATE UNIQUE NONCLUSTERED INDEX [AK_Culture_Name] | ||
25 | ON [Production].[Culture] ([Name]) | ||
26 | ON [PRIMARY] | ||
27 | GO | ||
28 | ALTER TABLE [Production].[Culture] SET (LOCK_ESCALATION = TABLE) | ||
29 | GO | ||
30 |
Table [Production].[ProductModelProductDescriptionCulture]//[Production].[ProductModelProductDescriptionCulture] (back to Summary) |
---|
Source project | Target database | ||
---|---|---|---|
1 | SET ANSI_NULLS ON | 1 | SET ANSI_NULLS ON |
2 | SET QUOTED_IDENTIFIER ON | 2 | SET QUOTED_IDENTIFIER ON |
3 | 3 | ||
4 | GO | 4 | GO |
5 | CREATE TABLE [Production].[ProductModelProductDescriptionCulture] ( | 5 | CREATE TABLE [Production].[ProductModelProductDescriptionCulture] ( |
6 | [ProductModelID] [int] NOT NULL, | 6 | [ProductModelID] [int] NOT NULL, |
7 | [ProductDescriptionID] [int] NOT NULL, | 7 | [ProductDescriptionID] [int] NOT NULL, |
8 | [CultureID] [nchar](6) NOT NULL, | ||
8 | [ModifiedDate] [datetime] NOT NULL | 9 | [ModifiedDate] [datetime] NOT NULL |
9 | ) ON [PRIMARY] | 10 | ) ON [PRIMARY] |
10 | GO | 11 | GO |
11 | ALTER TABLE [Production].[ProductModelProductDescriptionCulture] | 12 | ALTER TABLE [Production].[ProductModelProductDescriptionCulture] |
12 | ADD | 13 | ADD |
13 | CONSTRAINT [PK_ProductModelProductDescriptionCulture_ProductModelID_ProductDescriptionID_CultureID] | 14 | CONSTRAINT [PK_ProductModelProductDescriptionCulture_ProductModelID_ProductDescriptionID_CultureID] |
14 | PRIMARY KEY | 15 | PRIMARY KEY |
15 | CLUSTERED | 16 | CLUSTERED |
16 | ([ProductModelID], [ProductDescriptionID]) | 17 | ([ProductModelID], [ProductDescriptionID], [CultureID]) |
17 | ON [PRIMARY] | 18 | ON [PRIMARY] |
18 | GO | 19 | GO |
19 | ALTER TABLE [Production].[ProductModelProductDescriptionCulture] | 20 | ALTER TABLE [Production].[ProductModelProductDescriptionCulture] |
20 | ADD | 21 | ADD |
21 | CONSTRAINT [DF_ProductModelProductDescriptionCulture_ModifiedDate] | 22 | CONSTRAINT [DF_ProductModelProductDescriptionCulture_ModifiedDate] |
23 | DEFAULT (getdate()) FOR [ModifiedDate] | ||
24 | GO | ||
25 | ALTER TABLE [Production].[ProductModelProductDescriptionCulture] | ||
26 | WITH CHECK | ||
27 | ADD CONSTRAINT [FK_ProductModelProductDescriptionCulture_Culture_CultureID] | ||
28 | FOREIGN KEY ([CultureID]) REFERENCES [Production].[Culture] ([CultureID]) | ||
29 | ALTER TABLE [Production].[ProductModelProductDescriptionCulture] | ||
30 | CHECK CONSTRAINT [FK_ProductModelProductDescriptionCulture_Culture_CultureID] | ||
22 | DEFAULT (getdate()) FOR [ModifiedDate] | 31 | |
23 | GO | 32 | GO |
24 | ALTER TABLE [Production].[ProductModelProductDescriptionCulture] | 33 | ALTER TABLE [Production].[ProductModelProductDescriptionCulture] |
25 | WITH CHECK | 34 | WITH CHECK |
26 | ADD CONSTRAINT [FK_ProductModelProductDescriptionCulture_ProductDescription_ProductDescriptionID] | 35 | ADD CONSTRAINT [FK_ProductModelProductDescriptionCulture_ProductDescription_ProductDescriptionID] |
27 | FOREIGN KEY ([ProductDescriptionID]) REFERENCES [Production].[ProductDescription] ([ProductDescriptionID]) | 36 | FOREIGN KEY ([ProductDescriptionID]) REFERENCES [Production].[ProductDescription] ([ProductDescriptionID]) |
28 | ALTER TABLE [Production].[ProductModelProductDescriptionCulture] | 37 | ALTER TABLE [Production].[ProductModelProductDescriptionCulture] |
29 | CHECK CONSTRAINT [FK_ProductModelProductDescriptionCulture_ProductDescription_ProductDescriptionID] | 38 | CHECK CONSTRAINT [FK_ProductModelProductDescriptionCulture_ProductDescription_ProductDescriptionID] |
30 | 39 | ||
31 | GO | 40 | GO |
32 | ALTER TABLE [Production].[ProductModelProductDescriptionCulture] | 41 | ALTER TABLE [Production].[ProductModelProductDescriptionCulture] |
33 | WITH CHECK | 42 | WITH CHECK |
34 | ADD CONSTRAINT [FK_ProductModelProductDescriptionCulture_ProductModel_ProductModelID] | 43 | ADD CONSTRAINT [FK_ProductModelProductDescriptionCulture_ProductModel_ProductModelID] |
35 | FOREIGN KEY ([ProductModelID]) REFERENCES [Production].[ProductModel] ([ProductModelID]) | 44 | FOREIGN KEY ([ProductModelID]) REFERENCES [Production].[ProductModel] ([ProductModelID]) |
36 | ALTER TABLE [Production].[ProductModelProductDescriptionCulture] | 45 | ALTER TABLE [Production].[ProductModelProductDescriptionCulture] |
37 | CHECK CONSTRAINT [FK_ProductModelProductDescriptionCulture_ProductModel_ProductModelID] | 46 | CHECK CONSTRAINT [FK_ProductModelProductDescriptionCulture_ProductModel_ProductModelID] |
38 | 47 | ||
39 | GO | 48 | GO |
40 | ALTER TABLE [Production].[ProductModelProductDescriptionCulture] SET (LOCK_ESCALATION = TABLE) | 49 | ALTER TABLE [Production].[ProductModelProductDescriptionCulture] SET (LOCK_ESCALATION = TABLE) |
41 | GO | 50 | GO |
42 | 51 |
View [Production].[vProductAndDescription]//[Production].[vProductAndDescription] (back to Summary) |
---|
Source project | Target database | ||
---|---|---|---|
1 | SET ANSI_NULLS ON | 1 | SET ANSI_NULLS ON |
2 | SET QUOTED_IDENTIFIER ON | 2 | SET QUOTED_IDENTIFIER ON |
3 | GO | 3 | GO |
4 | CREATE VIEW [Production].[vProductAndDescription] | 4 | CREATE VIEW [Production].[vProductAndDescription] |
5 | WITH SCHEMABINDING | 5 | WITH SCHEMABINDING |
6 | AS | 6 | AS |
7 | -- View (indexed or standard) to display products and product descriptions by language. | 7 | -- View (indexed or standard) to display products and product descriptions by language. |
8 | SELECT | 8 | SELECT |
9 | p.[ProductID] | 9 | p.[ProductID] |
10 | ,p.[Name] | 10 | ,p.[Name] |
11 | ,pm.[Name] AS [ProductModel] | 11 | ,pm.[Name] AS [ProductModel] |
12 | ,pmx.[CultureID] | ||
12 | ,pd.[Description] | 13 | ,pd.[Description] |
13 | FROM [Production].[Product] p | 14 | FROM [Production].[Product] p |
14 | INNER JOIN [Production].[ProductModel] pm | 15 | INNER JOIN [Production].[ProductModel] pm |
15 | ON p.[ProductModelID] = pm.[ProductModelID] | 16 | ON p.[ProductModelID] = pm.[ProductModelID] |
16 | INNER JOIN [Production].[ProductModelProductDescriptionCulture] pmx | 17 | INNER JOIN [Production].[ProductModelProductDescriptionCulture] pmx |
17 | ON pm.[ProductModelID] = pmx.[ProductModelID] | 18 | ON pm.[ProductModelID] = pmx.[ProductModelID] |
18 | INNER JOIN [Production].[ProductDescription] pd | 19 | INNER JOIN [Production].[ProductDescription] pd |
20 | ON pmx.[ProductDescriptionID] = pd.[ProductDescriptionID]; | ||
21 | GO | ||
22 | CREATE UNIQUE CLUSTERED INDEX [IX_vProductAndDescription] | ||
23 | ON [Production].[vProductAndDescription] ([CultureID], [ProductID]) | ||
19 | ON pmx.[ProductDescriptionID] = pd.[ProductDescriptionID]; | 24 | ON [PRIMARY] |
20 | GO | 25 | GO |
21 | 26 |
Copyright © 2013 ReadyRoll