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)
 Stored Procedure

Author  Topic 

oahu9872
Posting Yak Master

112 Posts

Posted - 2005-08-31 : 14:13:40
I need to run a stored procedure that will clear the contents of a table, then repopulate it with data from another. I'm not sure how to do this or if it can be done.

Thanks

SamC
White Water Yakist

3467 Posts

Posted - 2005-08-31 : 14:25:43
TRUNCATE TABLE MyTable -- Will remove all rows nicely

INSERT INTO MyTable (ColA, ColB, ... ColN)
SELECT ColA, ColB, ... ColN
FROM AnotherTable
Go to Top of Page

oahu9872
Posting Yak Master

112 Posts

Posted - 2005-08-31 : 15:12:25
Great, thanks
Go to Top of Page
   

- Advertisement -