select into non-temp table? (existing)
Thanks in advance for any help,
This is my code, it is querying a linked sql servers DB and this query works great...But I do not want the first line to drop table and I do not want to insert it into a temp table... I already have a table called ar_custcall_settlements with the proper fields ready but when I try to insert into just table name w/o # it says it already exists... I do not want to use temp tables but rather the existing table ar_custcall_settlements, and the last line (the final select) is just for testing...
________BEGIN CODE_______________________________
DROP table #ar_custcall_settlements ;
Select pa.date_entered,pa.sequence,
pa.customer_number,pa.batch_number,
pa.amount,
pa.code,pa.post_date,
pa.statement_date,pa.posted,
pa.row_id,pa.deposit_type,
cm.customer_name,cm.corporate_number,
cm.sales_region_number
INTO #ar_custcall_settlements
FROM cdwacx.cdwacx.dbo.payments_and_adjustments pa,cdwacx.cdwacx.dbo.customer_master cm
WHERE (pa.date_entered BETWEEN '10/28/2003 00:00:00' AND '10/28/2003 23:59:59') AND
(pa.customer_number = cm.customer_number) AND
(pa.code IN('994','992')) ;
SELECT * FROM #ar_custcall_settlements ;
|