Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Insert into a different DB

Author  Topic 

batgrrrl
Starting Member

8 Posts

Posted - 2001-11-04 : 22:18:28
Hi Guys :)

I need some advice on cross referencing SQL databases.

Basically I want to purge certain records from one table in a database, to a different table in a different database.

Here is my code (I hope I make sense!)

<snip>
use renee
DECLARE @UserInput smalldatetime

SET @UserInput = '10/10/2000'

INSERT INTO opo_purged.po_event_history_purged (po_event_history_id, po_header_id, po_num, po_event_id, po_invoice_id, date_time, event_by, via, ip_address, reason, po_detail_status_id)
SELECT *
FROM po_event_history
WHERE date_time < @UserInput
GO
</snip>

So I have the opo_purged database where the data is coming from. And want to send it to the identicle table in the renee database located on the same SQL server. Can I do this? I tried it with the opo_pruged.po_event.... refernce (database.table) but that didn't work.

Is it possible to do what I am trying to do?

Thanks for your help! Im completely stuck and cant get Books Online to spit out what I want :)

Renee


   

- Advertisement -