|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2004-05-27 : 10:44:48
|
| David McInally writes "I have a table with 3M rows and a table with 500K rows - I am performing a join to extract data - table A has 1.5M rows; table B has 3M rows - as follows : <SQL Server 2000> INSERT INTO TABLE_C (contract_id, product_id, licensee_id, territory_id, fees, right_code, start_date, end_date, runs, rerun, host_id, date_used, terr_rht_id, alloc, line, contract_date, revno, sectid, currcode, type)SELECT DISTINCT a.mainno, a.product, a.lcensee, a.terrcode, null, r.rhtcode, r.lbegdate, r.lexpdate, a.rnsprflm, null, :gs_host_id, :ldt_now, r.terrcode, 1, a.slineno, a.contdate, a.revno,null, null, 'D' FROM TABLE A, TABLE B WHERE A.mainno = B.mainno and A.revno = B.revno and A.sectid = B.sectid and A.slineno = B.slineno and B.status in ('2', '3') and B.rhttype in ('RE', 'RN', 'RO') and ((:ldt_end >= B.lbegdate or B.lbegdate is null) and (:ldt_start <= B.lexpdate or B.lexpdate is null)) ;every time I run this I run out of workspace in TempDB - 1.5G allocated. I cannot increase tempDB. Please Help?Thanks" |
|