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 |
|
tpiazza55
Posting Yak Master
162 Posts |
Posted - 2007-01-02 : 10:03:04
|
| i am creating an insert based on a select statement -- i need to delete the row from the select statment table after it has been insertedsomething like insert into table_insert(value1, value2) (select table_exclude_id, value1, value2 from table exclude)delete from table_exclude where table_exclude_id in "the select statement"can you do this? |
|
|
AndrewMurphy
Master Smack Fu Yak Hacker
2916 Posts |
Posted - 2007-01-02 : 10:07:14
|
| no....but you can put it 2 statements into 1 "transaction" so that either they both work, or neither works. |
 |
|
|
tpiazza55
Posting Yak Master
162 Posts |
Posted - 2007-01-02 : 10:16:01
|
| how do you put both statements into one transaction? |
 |
|
|
tpiazza55
Posting Yak Master
162 Posts |
Posted - 2007-01-02 : 10:18:16
|
| i tried it with cursors and its really slowto do the insert on the select with 8k record is a few secondsto do it with a cursor and the delete and insert takes several minutes |
 |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-01-02 : 10:24:56
|
| Duplicate question:[url]http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=76925[/url]Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
|
|
|