USE Pooja
GO
----Create TestTable
CREATE TABLE TestTable(RtJobCode VARCHAR(20), RtProfCode smallint,RtTestCode smallint,RtCenCode smallint,LabNo int,ProfCode smallint,ProfRate money,ProfName varchar(100),TestCode smallint,TestRate money,TestName varchar(100),TestCategory varchar(50),Cost money)
----INSERT INTO TestTable using SELECT
INSERT INTO TestTable (RtJobCode, RtProfCode,RtTestCode,RtCenCode,LabNo,ProfCode,ProfRate,ProfName,TestCode,TestRate,TestName,TestCategory,Cost)
SELECT RtJobCode
, RtProfCode
, RtTestCode
, RtCenCode
, LabNo
, ProfCode
, ProfRate
, ProfName
, TestCode
, TestRate
, TestName
, TestCategory
, Cost
FROM dbo.ResultTest
JOIN dbo.Test
ON ResultTest.RtTestCode = Test.TestCode
JOIN dbo.Profiles
ON ResultTest.RtProfCode = Profiles.ProfCode