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 |
|
waely
Starting Member
2 Posts |
Posted - 2007-04-23 : 14:30:08
|
| hi,how can I use stored proc to delete all rows from a table (table1) and insert new ones.for instance. my query is:-------------------------------------select field1, two, three from table1 innerjoin table2 on etc...where condition1 and condition2-------------------------------------I want to place the result in my table (table1) and everything I run the stored pro I want to delete the content and place the new dataset in the table1?I hope I'm clear what I'm trying to do.thank you very much in advance.P.S please be detailed when explaining. |
|
|
MutantNinjaLoungeSinger
Starting Member
14 Posts |
Posted - 2007-04-23 : 14:42:31
|
| No offense intended here, but how can you ask for a detailed explanation when you haven't given a very detailed view of your problem?I've read your post a couple times, and still not entirely sure what you're asking. Are you asking to see what rows have been deleted by placing them in some sort of temporary table? |
 |
|
|
cvraghu
Posting Yak Master
187 Posts |
Posted - 2007-04-23 : 17:39:57
|
| Read SQL Server Books online to know how to create a procedure, delete/insert a table. Here is the psuedo code for your question - create proc PROCNameasbeginDelete from Table1Insert into Table1 (columns...)select Values from your select statement.endAlso. in your example you want to delete from table1 and trying to select from table1 for repopulating it. May be a typo? |
 |
|
|
waely
Starting Member
2 Posts |
Posted - 2007-04-23 : 18:01:38
|
| Thank you cvraghu, that answered my question.waely |
 |
|
|
|
|
|