INSERT INTO [dbo].[TestCases]
(
[Projectid],
[TestCaseName],
[SourcePath],
[DestinationPath],
[Xpath],
[LogicalOperator],
[Value],
[ConnectionString] ,
[TestFilesPath],
[SearchPattern]
)
SELECT
p.[Projectid],
tc.[TestCaseName],
tc.[SourcePath],
tc.[DestinationPath],
tc.[Xpath],
tc.[LogicalOperator],
tc.[Value],
tc.[ConnectionString] ,
tc.[TestFilesPath],
tc.[SearchPattern]
from [dbo].[tbl_TestCases] tc
join tbl_Projects pr on tc.Projectid = pr.ProjectId
join [dbo].[Projects] p on p.ProjectName = pr.ProjectName