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 2005 Forums
 Transact-SQL (2005)
 need help?

Author  Topic 

zakeer
Starting Member

20 Posts

Posted - 2008-03-18 : 08:47:16
i have a sp. it contains three insert statements. i want to commit only third insert statement. the rest has to be rolledback.

how can i do this?

Thanks & Regards
Zakeer

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-03-18 : 08:48:44
put the third insert alone in another transaction
Go to Top of Page

elancaster
A very urgent SQL Yakette

1208 Posts

Posted - 2008-03-18 : 08:50:56
why do i get the feeling these are all your homework questions?

...look at transactions in Books Online. once you've starte a transaction you can chose whether to commit or rollback. show us what you've tried and we will help you with the syntax

Em
Go to Top of Page

LoztInSpace
Aged Yak Warrior

940 Posts

Posted - 2008-03-18 : 21:15:36
This is a pointless exercise. Why would you do an insert at all if you don't want to commit it? I think you've missed the point of transactions.

Anyway, the answer to your question (if you really and truly want to do this) is to put appropriate DELETE statements to get rid of the first 2 rows before you commit.
Go to Top of Page
   

- Advertisement -