|
tchinedu
Yak Posting Veteran
71 Posts |
Posted - 2006-09-29 : 11:41:43
|
| Please help guys,I have two tablesTable1declare @Table1 Table( LineID int identity(1,1) primary key, BreakerName nvarchar(255))Insert into @BreakerTble (BreakerName) select 'Collateral Types' union all select 'Origination' union all select 'CutOff' union all select 'Maturity' union all select 'Coupon' union all select 'Ratios' union all select 'FScores' union all select 'DRatios' union all select 'GeoDistribution' union all select 'OccTypes' union all select 'DocTypes'Table2declare @Table2 table( SerNum int Identity(1,1) primary key, SetName varchar(255), GrId int, PName varchar(255), PId int, PItemId int, GNumber int, LId varchar(20), CBalance decimal(30,2), Rot decimal(30,20), Mot decimal(30,20), Lot decimal(30,20), OBalance decimal(30,2), PId int, RTerm int, SBal decimal(30,2), PCalcId int, PTerm int, PMonths decimal(30,20), )Table 2 has thousands of row.I want to select each row in table two with each of the straing values in table1...I currently have it as:SELECT ta.SetName, ta.GrId, ta.PName, ta.PId, ta.PItemId, ta.GNumber, ta.LId, ta.CBalance, ta.Rot, ta.Mot, ta.Lot, ta.OBalance, ta.PLId, ta.RTerm, ta.SBal, ta.PCalcId, ta.PTerm, ta.PMonths, tb.BreakerNameFrom @Table2 tacross join @Table1 tbthis takes a little while as the records in table2 get over 20,000is there a faster way to achieve this |
|