I work on SQL server 2012 I face issue when insert rows it take too much time
and on final no rows added
EXECUTION PLAN AS BELOW
tables script
CREATE TABLE [Parts].[TradeCodes](
[TradeCodesID] [int] IDENTITY(1,1) NOT NULL,
[PartID] [int] NOT NULL,
[Code] [varchar](20) NOT NULL,
[CodeTypeID] [int] NOT NULL,
[SourceTypeID] [bigint] NULL,
[RevisionID] [bigint] NULL,
[ModifiedDate] [datetime] NULL,
[CreatedDate] [datetime] NOT NULL,
[Modifiedby] [int] NULL,
[CreatedBy] [int] NULL,
[PartLevel] [tinyint] NULL,
[ZPLID] [int] NULL,
[MappingDoneFlag] [int] NOT NULL,
[MappingValueId] [int] NOT NULL,
CONSTRAINT [PK__TradeCod__FEFAF27527F7A1C3] PRIMARY KEY CLUSTERED
(
[TradeCodesID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY],
CONSTRAINT [UC_PartCode] UNIQUE NONCLUSTERED
(
[PartID] ASC,
[CodeTypeID] ASC,
[PartLevel] 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
SET ANSI_PADDING ON
GO
ALTER TABLE [Parts].[TradeCodes] ADD CONSTRAINT [DF__TradeCode__Creat__215D38B9] DEFAULT (getdate()) FOR [CreatedDate]
GO
ALTER TABLE [Parts].[TradeCodes] ADD DEFAULT ((0)) FOR [MappingDoneFlag]
GO
ALTER TABLE [Parts].[TradeCodes] ADD DEFAULT ((0)) FOR [MappingValueId]
table that insert on it
USE [ExtractReports]
GO
/****** Object: Table [dbo].[TradeCodesInsert] Script Date: 11/3/2021 9:44:54 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[TradeCodesInsert](
[TradeCodesID] [int] IDENTITY(1,1) NOT NULL,
[PartID] [int] NOT NULL,
[Code] [varchar](20) NOT NULL,
[CodeTypeID] [int] NOT NULL,
[SourceTypeID] [bigint] NULL,
[RevisionID] [bigint] NULL,
[ModifiedDate] [datetime] NULL,
[CreatedDate] [datetime] NOT NULL,
[Modifiedby] [int] NULL,
[CreatedBy] [int] NULL,
[PartLevel] [tinyint] NULL,
[ZPLID] [int] NULL,
[FunctionName] [nvarchar](50) NULL,
[MappingDoneFlag] [int] NOT NULL,
[MappingValueId] [int] NOT NULL,
[FeatureName] [nvarchar](500) NULL,
[FeatureValue] [nvarchar](500) NULL,
[FlagInsert] [int] NULL,
CONSTRAINT [PK__TradeCod__FEFAF27527F7A1C3] PRIMARY KEY CLUSTERED
(
[TradeCodesID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY],
CONSTRAINT [UC_PartCode] UNIQUE NONCLUSTERED
(
[PartID] ASC,
[CodeTypeID] ASC,
[PartLevel] 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
SET ANSI_PADDING OFF
GO
ALTER TABLE [dbo].[TradeCodesInsert] ADD CONSTRAINT [DF__TradeCode__Creat__215D38B9] DEFAULT (getdate()) FOR [CreatedDate]
GO
ALTER TABLE [dbo].[TradeCodesInsert] ADD DEFAULT ((0)) FOR [MappingDoneFlag]
GO
ALTER TABLE [dbo].[TradeCodesInsert] ADD DEFAULT ((0)) FOR [MappingValueId]
GO