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.
| Author |
Topic |
|
Dwish1372
Starting Member
7 Posts |
Posted - 2008-01-14 : 22:39:09
|
| hi everyone,I have a couple questions. I'm very new to SQL and I have this problem:I need to be able to drop the contents of Existingtable_B into Newtable_A - I found this command (below) that will make a 'copy' but I don't want to keep the contents of Existingtable_B. Is it possible to drop them into Newtable_A instead of copy? Also, I want to do this for 5 tables on Sundays at midnight.. how could I schedule that? Finally, what happens if there is not enough space or some other critical error happens during this procedure? I don't want to lose the data.Any help is greatly appreciated. |
|
|
Dwish1372
Starting Member
7 Posts |
Posted - 2008-01-14 : 22:42:32
|
| select * into Newtable_A from Existingtable_B |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2008-01-14 : 22:52:01
|
insert into Newtable_A ( column list )select <columns>from Existingtable_B you might also want to check for existing of Existingtable_B record in Newtable_A KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2008-01-14 : 22:55:04
|
Note : SELECT INTO will create the target table if will fail if the target table existed KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-01-16 : 03:20:16
|
| insert into Newtable_A ( column list )select <columns>from Existingtable_B where some_conditionDelete from Existingtable_Bwhere some_conditionSchedule it as a jobMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|