SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[New_offerBase](
[CreatedBy] [uniqueidentifier] NULL,
[CreatedOn] [datetime] NULL,
[ImportSequenceNumber] [int] NULL,
[ModifiedBy] [uniqueidentifier] NULL,
[ModifiedOn] [datetime] NULL,
[New_offerId] [uniqueidentifier] NOT NULL,
[OverriddenCreatedOn] [datetime] NULL,
[OwningBusinessUnit] [uniqueidentifier] NULL,
[statecode] [int] NOT NULL,
[statuscode] [int] NULL,
[TimeZoneRuleVersionNumber] [int] NULL,
[UTCConversionTimeZoneCode] [int] NULL,
[VersionNumber] [timestamp] NULL,
[OwnerId] [uniqueidentifier] NOT NULL,
[OwnerIdType] [int] NOT NULL,
[CreatedOnBehalfBy] [uniqueidentifier] NULL,
[ModifiedOnBehalfBy] [uniqueidentifier] NULL,
CONSTRAINT [PK_New_offerBase] PRIMARY KEY CLUSTERED
(
[New_offerId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
ALTER AUTHORIZATION ON [dbo].[New_offerBase] TO SCHEMA OWNER
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[New_offercomponentBase](
[CreatedBy] [uniqueidentifier] NULL,
[CreatedOn] [datetime] NULL,
[ImportSequenceNumber] [int] NULL,
[ModifiedBy] [uniqueidentifier] NULL,
[ModifiedOn] [datetime] NULL,
[New_offercomponentId] [uniqueidentifier] NOT NULL,
[OverriddenCreatedOn] [datetime] NULL,
[OwningBusinessUnit] [uniqueidentifier] NULL,
[statecode] [int] NOT NULL,
[statuscode] [int] NULL,
[TimeZoneRuleVersionNumber] [int] NULL,
[UTCConversionTimeZoneCode] [int] NULL,
[VersionNumber] [timestamp] NULL,
[OwnerId] [uniqueidentifier] NOT NULL,
[OwnerIdType] [int] NOT NULL,
[CreatedOnBehalfBy] [uniqueidentifier] NULL,
[ModifiedOnBehalfBy] [uniqueidentifier] NULL,
CONSTRAINT [PK_New_offercomponentBase] PRIMARY KEY CLUSTERED
(
[New_offercomponentId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
ALTER AUTHORIZATION ON [dbo].[New_offercomponentBase] TO SCHEMA OWNER
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[New_offercomponentExtensionBase](
[New_availability] [int] NULL,
[New_code] [nvarchar](100) NULL,
[New_codegaranty] [nvarchar](100) NULL,
[New_comment] [nvarchar](max) NULL,
[New_costgaranty] [float] NULL,
[New_count] [int] NULL,
[New_deliverydate] [int] NULL,
[New_descrgaranty] [nvarchar](max) NULL,
[New_isbase] [bit] NULL,
[New_level] [nvarchar](200) NULL,
[New_Level1] [nvarchar](200) NULL,
[New_location] [nvarchar](100) NULL,
[New_margin] [float] NULL,
[New_marginsumma] [float] NULL,
[New_model] [nvarchar](200) NULL,
[New_name] [nvarchar](max) NULL,
[New_nds] [bit] NULL,
[New_offercomponentId] [uniqueidentifier] NOT NULL,
[New_PartNumber] [nvarchar](100) NULL,
[New_PL] [float] NULL,
[New_primecost] [float] NULL,
[New_producer] [nvarchar](100) NULL,
[New_requestdateoz] [datetime] NULL,
[New_totalcost] [float] NULL,
[New_typesource] [int] NULL,
[New_volume] [float] NULL,
[New_weight] [float] NULL,
[new_product] [uniqueidentifier] NULL,
CONSTRAINT [PK_New_offercomponentExtensionBase] PRIMARY KEY CLUSTERED
(
[New_offercomponentId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
ALTER AUTHORIZATION ON [dbo].[New_offercomponentExtensionBase] TO SCHEMA OWNER
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[New_offerExtensionBase](
[New_comment] [nvarchar](max) NULL,
[New_isagreement] [bit] NULL,
[New_name] [nvarchar](100) NULL,
[New_offerId] [uniqueidentifier] NOT NULL,
[New_offername] [nvarchar](1000) NULL,
[new_contact] [uniqueidentifier] NULL,
[new_client] [uniqueidentifier] NULL,
[new_pipeline] [uniqueidentifier] NULL,
[New_legal] [uniqueidentifier] NULL,
[new_status] [int] NULL,
[new_probability] [int] NULL,
[new_margin] [decimal](23, 10) NULL,
[new_amount] [decimal](23, 10) NULL,
[new_marginamount] [decimal](23, 10) NULL,
[new_totalamount] [decimal](23, 10) NULL,
[new_transferdate] [datetime] NULL,
[new_week] [int] NULL,
[new_statusdate] [datetime] NULL,
[new_balanceunit] [uniqueidentifier] NULL,
[new_refusereason] [int] NULL,
[new_plan] [uniqueidentifier] NULL,
[new_architector] [uniqueidentifier] NULL,
[new_week1amount] [decimal](23, 10) NULL,
[new_week2amount] [decimal](23, 10) NULL,
[new_week3amount] [decimal](23, 10) NULL,
[new_week4amount] [decimal](23, 10) NULL,
[new_week5amount] [decimal](23, 10) NULL,
[new_week1] [int] NULL,
[new_week2] [int] NULL,
[new_week3] [int] NULL,
[new_week4] [int] NULL,
[new_week5] [int] NULL,
[new_tender] [nvarchar](100) NULL,
[new_opportunity] [uniqueidentifier] NULL,
[new_campain] [uniqueidentifier] NULL,
[new_leadinitiator] [uniqueidentifier] NULL,
[new_leadsource] [int] NULL,
[new_ibsinitiator] [nvarchar](100) NULL,
[new_ibsinitiatorid] [nvarchar](10) NULL,
[new_requestsaccess] [nvarchar](max) NULL,
[new_tender_link] [nvarchar](100) NULL,
[new_tender_planneddate] [datetime] NULL,
[new_tender_request_date] [datetime] NULL,
[new_PADAmount] [decimal](23, 10) NULL,
[new_GPLAmount] [decimal](23, 10) NULL,
[new_discountlevel] [decimal](23, 10) NULL,
[new_partner] [uniqueidentifier] NULL,
CONSTRAINT [PK_New_offerExtensionBase] PRIMARY KEY CLUSTERED
(
[New_offerId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
ALTER AUTHORIZATION ON [dbo].[New_offerExtensionBase] TO SCHEMA OWNER
GO
GRANT UPDATE ON [dbo].[New_offerExtensionBase] TO [StreamUser] AS [dbo]
GO
CREATE NONCLUSTERED INDEX [ndx_Core] ON [dbo].[New_offerBase]
(
[statecode] ASC,
[statuscode] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 80) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [ndx_Security] ON [dbo].[New_offerBase]
(
[OwnerId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 80) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [ndx_Sync] ON [dbo].[New_offerBase]
(
[VersionNumber] ASC
)
WHERE ([VersionNumber] IS NOT NULL)
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 80) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [ndx_Core] ON [dbo].[New_offercomponentBase]
(
[statecode] ASC,
[statuscode] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 80) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [ndx_Security] ON [dbo].[New_offercomponentBase]
(
[OwnerId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 80) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [ndx_Sync] ON [dbo].[New_offercomponentBase]
(
[VersionNumber] ASC
)
WHERE ([VersionNumber] IS NOT NULL)
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 80) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [ndx_SystemManaged_New_offercomponent] ON [dbo].[New_offercomponentBase]
(
[CreatedOn] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 80) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [ndx_for_cascaderelationship_new_new_product_new_offercomponent] ON [dbo].[New_offercomponentExtensionBase]
(
[new_product] ASC
)
WHERE ([new_product] IS NOT NULL)
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 80) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
CREATE NONCLUSTERED INDEX [ndx_New_code] ON [dbo].[New_offercomponentExtensionBase]
(
[New_code] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 80) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [ndx_for_cascaderelationship_new_account_new_offer] ON [dbo].[New_offerExtensionBase]
(
[new_client] ASC
)
WHERE ([new_client] IS NOT NULL)
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 80) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
CREATE NONCLUSTERED INDEX [ndx_New_name] ON [dbo].[New_offerExtensionBase]
(
[New_name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 80) ON [PRIMARY]
GO
ALTER TABLE [dbo].[New_offerBase] ADD CONSTRAINT [DF_New_offerBase_OwnerId] DEFAULT ('00000000-0000-0000-0000-000000000000') FOR [OwnerId]
GO
ALTER TABLE [dbo].[New_offerBase] ADD CONSTRAINT [DF_New_offerBase_OwnerIdType] DEFAULT ((8)) FOR [OwnerIdType]
GO
ALTER TABLE [dbo].[New_offercomponentBase] ADD CONSTRAINT [DF_New_offercomponentBase_OwnerId] DEFAULT ('00000000-0000-0000-0000-000000000000') FOR [OwnerId]
GO
ALTER TABLE [dbo].[New_offercomponentBase] ADD CONSTRAINT [DF_New_offercomponentBase_OwnerIdType] DEFAULT ((8)) FOR [OwnerIdType]
GO
ALTER TABLE [dbo].[New_offerBase] WITH NOCHECK ADD CONSTRAINT [business_unit_new_offer] FOREIGN KEY([OwningBusinessUnit])
REFERENCES [dbo].[BusinessUnitBase] ([BusinessUnitId])
NOT FOR REPLICATION
GO
ALTER TABLE [dbo].[New_offerBase] CHECK CONSTRAINT [business_unit_new_offer]
GO
ALTER TABLE [dbo].[New_offerBase] WITH NOCHECK ADD CONSTRAINT [owner_new_offer] FOREIGN KEY([OwnerId])
REFERENCES [dbo].[OwnerBase] ([OwnerId])
NOT FOR REPLICATION
GO
ALTER TABLE [dbo].[New_offerBase] CHECK CONSTRAINT [owner_new_offer]
GO
ALTER TABLE [dbo].[New_offercomponentBase] WITH NOCHECK ADD CONSTRAINT [business_unit_new_offercomponent] FOREIGN KEY([OwningBusinessUnit])
REFERENCES [dbo].[BusinessUnitBase] ([BusinessUnitId])
NOT FOR REPLICATION
GO
ALTER TABLE [dbo].[New_offercomponentBase] CHECK CONSTRAINT [business_unit_new_offercomponent]
GO
ALTER TABLE [dbo].[New_offercomponentBase] WITH NOCHECK ADD CONSTRAINT [owner_new_offercomponent] FOREIGN KEY([OwnerId])
REFERENCES [dbo].[OwnerBase] ([OwnerId])
NOT FOR REPLICATION
GO
ALTER TABLE [dbo].[New_offercomponentBase] CHECK CONSTRAINT [owner_new_offercomponent]
GO
ALTER TABLE [dbo].[New_offercomponentExtensionBase] WITH CHECK ADD CONSTRAINT [FK_New_offercomponentExtensionBase_New_offercomponentBase] FOREIGN KEY([New_offercomponentId])
REFERENCES [dbo].[New_offercomponentBase] ([New_offercomponentId])
GO
ALTER TABLE [dbo].[New_offercomponentExtensionBase] CHECK CONSTRAINT [FK_New_offercomponentExtensionBase_New_offercomponentBase]
GO
ALTER TABLE [dbo].[New_offercomponentExtensionBase] WITH NOCHECK ADD CONSTRAINT [new_new_product_new_offercomponent] FOREIGN KEY([new_product])
REFERENCES [dbo].[New_productBase] ([New_productId])
NOT FOR REPLICATION
GO
ALTER TABLE [dbo].[New_offercomponentExtensionBase] CHECK CONSTRAINT [new_new_product_new_offercomponent]
GO
ALTER TABLE [dbo].[New_offerExtensionBase] WITH CHECK ADD CONSTRAINT [FK_New_offerExtensionBase_New_offerBase] FOREIGN KEY([New_offerId])
REFERENCES [dbo].[New_offerBase] ([New_offerId])
GO
ALTER TABLE [dbo].[New_offerExtensionBase] CHECK CONSTRAINT [FK_New_offerExtensionBase_New_offerBase]
GO
ALTER TABLE [dbo].[New_offerExtensionBase] WITH NOCHECK ADD CONSTRAINT [new_account_new_offer] FOREIGN KEY([new_client])
REFERENCES [dbo].[AccountBase] ([AccountId])
NOT FOR REPLICATION
GO
ALTER TABLE [dbo].[New_offerExtensionBase] CHECK CONSTRAINT [new_account_new_offer]
GO
ALTER TABLE [dbo].[New_offerExtensionBase] WITH NOCHECK ADD CONSTRAINT [new_architector] FOREIGN KEY([new_architector])
REFERENCES [dbo].[SystemUserBase] ([SystemUserId])
NOT FOR REPLICATION
GO
ALTER TABLE [dbo].[New_offerExtensionBase] CHECK CONSTRAINT [new_architector]
GO
ALTER TABLE [dbo].[New_offerExtensionBase] WITH NOCHECK ADD CONSTRAINT [new_contact_new_offer] FOREIGN KEY([new_contact])
REFERENCES [dbo].[ContactBase] ([ContactId])
NOT FOR REPLICATION
GO
ALTER TABLE [dbo].[New_offerExtensionBase] CHECK CONSTRAINT [new_contact_new_offer]
GO
ALTER TABLE [dbo].[New_offerExtensionBase] WITH NOCHECK ADD CONSTRAINT [new_leadinitiator] FOREIGN KEY([new_leadinitiator])
REFERENCES [dbo].[SystemUserBase] ([SystemUserId])
NOT FOR REPLICATION
GO
ALTER TABLE [dbo].[New_offerExtensionBase] CHECK CONSTRAINT [new_leadinitiator]
GO
ALTER TABLE [dbo].[New_offerExtensionBase] WITH NOCHECK ADD CONSTRAINT [new_legal_new_offer] FOREIGN KEY([New_legal])
REFERENCES [dbo].[New_legalBase] ([New_legalId])
NOT FOR REPLICATION
GO
ALTER TABLE [dbo].[New_offerExtensionBase] CHECK CONSTRAINT [new_legal_new_offer]
GO
ALTER TABLE [dbo].[New_offerExtensionBase] WITH NOCHECK ADD CONSTRAINT [new_new_pipeline_new_offer] FOREIGN KEY([new_pipeline])
REFERENCES [dbo].[New_pipelineBase] ([New_pipelineId])
NOT FOR REPLICATION
GO
ALTER TABLE [dbo].[New_offerExtensionBase] CHECK CONSTRAINT [new_new_pipeline_new_offer]
GO
ALTER TABLE [dbo].[New_offerExtensionBase] WITH NOCHECK ADD CONSTRAINT [new_offer_balanceunit] FOREIGN KEY([new_balanceunit])
REFERENCES [dbo].[New_moneyrecipientBase] ([New_moneyrecipientId])
NOT FOR REPLICATION
GO
ALTER TABLE [dbo].[New_offerExtensionBase] CHECK CONSTRAINT [new_offer_balanceunit]
GO
ALTER TABLE [dbo].[New_offerExtensionBase] WITH NOCHECK ADD CONSTRAINT [new_offer_campain] FOREIGN KEY([new_campain])
REFERENCES [dbo].[CampaignBase] ([CampaignId])
NOT FOR REPLICATION
GO
ALTER TABLE [dbo].[New_offerExtensionBase] CHECK CONSTRAINT [new_offer_campain]
GO
ALTER TABLE [dbo].[New_offerExtensionBase] WITH NOCHECK ADD CONSTRAINT [new_offer_partner] FOREIGN KEY([new_partner])
REFERENCES [dbo].[AccountBase] ([AccountId])
NOT FOR REPLICATION
GO
ALTER TABLE [dbo].[New_offerExtensionBase] CHECK CONSTRAINT [new_offer_partner]
GO
ALTER TABLE [dbo].[New_offerExtensionBase] WITH NOCHECK ADD CONSTRAINT [new_opportunity_offer] FOREIGN KEY([new_opportunity])
REFERENCES [dbo].[new_opportunityBase] ([new_opportunityId])
NOT FOR REPLICATION
GO
ALTER TABLE [dbo].[New_offerExtensionBase] CHECK CONSTRAINT [new_opportunity_offer]
GO
ALTER TABLE [dbo].[New_offerExtensionBase] WITH NOCHECK ADD CONSTRAINT [new_plan_offer] FOREIGN KEY([new_plan])
REFERENCES [dbo].[new_planBase] ([new_planId])
NOT FOR REPLICATION
GO
ALTER TABLE [dbo].[New_offerExtensionBase] CHECK CONSTRAINT [new_plan_offer]
GO