Jump to content

One serious doubt in SQL.. Please help


Recommended Posts

Posted

try  this

Begin work
Use db
Go
Delete from table where id=5
end
___________________
then rollback

rollback work ;

  • Replies 33
  • Created
  • Last Reply

Top Posters In This Topic

  • Jambhalheart

    10

  • Ranga_The_Donga

    6

  • dkchinnari

    5

  • pulithoka

    4

Popular Days

Top Posters In This Topic

Posted

[quote author=Jeedeelu link=topic=219819.msg2708827#msg2708827 date=1312388428]
begin transaction

delete from test where id=5

rollback tran
[/quote]

[img]http://i51.tinypic.com/2jbwmzt.gif[/img]

[quote author=Maddy_Rulez link=topic=219819.msg2708828#msg2708828 date=1312388447]

here, ur using begin transaction but I want to rollback a statement without using begin transaction
[/quote]

Posted

Nenu ninna idhe cheppa avvatledhu ani evadu pattinchukoledhu  s%H# s%H#

Posted

[quote author=Jeedeelu link=topic=219819.msg2708841#msg2708841 date=1312388610]
chusukoledhu ba....... CITI_$D# CITI_$D# CITI_$D#
[/quote] ^^"  ^^" ^^" CITI_$D#

Posted

[quote author=Maddy_Rulez link=topic=219819.msg2708846#msg2708846 date=1312388668]
[img]http://i51.tinypic.com/2jbwmzt.gif[/img]
[/quote] +_([quote author=Jeedeelu link=topic=219819.msg2708836#msg2708836 date=1312388553]
i think u cant rollback without begin transaction...

and error kuda dhani gurinche chepthunattundhii...
[/quote]

Posted

[quote author=pulithoka link=topic=219819.msg2708847#msg2708847 date=1312388674]
Nenu ninna idhe cheppa avvatledhu ani evadu pattinchukoledhu  s%H# s%H#
[/quote]

adhe kadha, avvadam ledhu ante avthondi annaru aa thadu lo chala mandhi...

[quote author=Jeedeelu link=topic=219819.msg2708836#msg2708836 date=1312388553]
i think u cant rollback without begin transaction...

and error kuda dhani gurinche chepthunattundhii...
[/quote]


ninna oka thadu avthundi ani chinna debate jarigindhi mama, I will post that link wait..

Posted

dont comment out ur delete statement.....

delete statement
rollback


okasari execute cheyyi.....

Posted

[quote author=Jeedeelu link=topic=219819.msg2708891#msg2708891 date=1312389237]
dont comment out ur delete statement.....

delete statement
rollback


okasari execute cheyyi.....
[/quote] @gr33d

Posted

[quote author=Jeedeelu link=topic=219819.msg2708891#msg2708891 date=1312389237]
dont comment out ur delete statement.....

delete statement
rollback


okasari execute cheyyi.....
[/quote]

appudu record delete ayyi,, same error vasthondi , mama like this..


(1 row(s) affected)
Msg 3903, Level 16, State 1, Line 5
The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION.

Posted

[quote author=Jeedeelu link=topic=219819.msg2708836#msg2708836 date=1312388553]
i think u cant rollback without begin transaction...

and error kuda dhani gurinche chepthunattundhii...
[/quote]

ninna oka thadu lo ela post vesaru mama... many said that we can rollback even thou if we not using begin transaction.... anduke nenu confuse ayya...

[img]http://i51.tinypic.com/2jbwmzt.gif[/img]

[quote author=meghana9 link=topic=219378.msg2703207#msg2703207 date=1312304033]
delete from Employee where id = '01';

1 row deleted.
______________________________________________
select id, last_name from Employee where id = '01';

no rows selected ,since we deleted the row where id = 01
_________________________________

rollback;

Rollback complete.



this example is from google .
[/quote]


[quote author=meghana9 link=topic=219378.msg2703270#msg2703270 date=1312304806]
till we commit the transcation we can do rollback. once we commit we cant do anything that is the reason why we have backup data ..
correct me if am wrong ...
[/quote]

[quote author=meghana9 link=topic=219378.msg2703382#msg2703382 date=1312305853]
row ane kadu... previous changes ni restore cheyatam... as we do UNDO ..\
delete lo ithe row ani chepochu
[/quote]

Posted

Goto SSMS--->Tools---->Options

Select query execution --> sqlserver--> ansi

Check the Set Implicit transaction checkbox. now execute the same statement it will rollback

Posted

[quote author=pulithoka link=topic=219819.msg2708978#msg2708978 date=1312390316]
Goto SSMS--->Tools---->Options

Select query execution --> sqlserver--> ansi

Check the Set Implicit transaction checkbox. now execute the same statement it will rollback
[/quote]

ledhu , avvadam ledhu... i m getting same error like this..


(1 row(s) affected)
Msg 3903, Level 16, State 1, Line 5
The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION.

Posted

[quote author=Maddy_Rulez link=topic=219819.msg2708991#msg2708991 date=1312390561]
ledhu , avvadam ledhu... i m getting same error like this..


(1 row(s) affected)
Msg 3903, Level 16, State 1, Line 5
The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION.

[/quote]

After doing that open a new query window and execute the statement. Let me know what happens

Posted

[quote author=pulithoka link=topic=219819.msg2708996#msg2708996 date=1312390619]
After doing that open a new query window and execute the statement. Let me know what happens
[/quote]

[img]http://www.desigifs.com/sites/default/files/bemmi.whistle_0.gif[/img][img width=106 height=118]http://www.desigifs.com/sites/default/files/bemmi.whistle_0.gif[/img][img width=106 height=118]http://www.desigifs.com/sites/default/files/bemmi.whistle_0.gif[/img][img width=106 height=118]http://www.desigifs.com/sites/default/files/bemmi.whistle_0.gif[/img][img width=106 height=118]http://www.desigifs.com/sites/default/files/bemmi.whistle_0.gif[/img][img width=106 height=118]http://www.desigifs.com/sites/default/files/bemmi.whistle_0.gif[/img]



super its working now........... thankyou  CITI_$D# CITI_$D#


kani edhi ela work ayyindho , enduku work ayyindho cheppava plsss

Posted

Hope this helps


When ON, SET IMPLICIT_TRANSACTIONS sets the connection into implicit transaction mode. When OFF, it returns the connection to autocommit transaction mode.

When a connection is in implicit transaction mode and the connection is not currently in a transaction, executing any of the following statements starts a transaction:

ALTER TABLE, FETCH, REVOKE, BEGIN TRANSACTION, GRANT, SELECT, CREATE, INSERT, TRUNCATE TABLE, DELETE, OPEN, UPDATE, DROP

If the connection is already in an open transaction, the statements do not start a new transaction.
Transactions that are automatically opened as the result of this setting being ON must be explicitly committed or rolled back by the user at the end of the transaction. Otherwise, the transaction and all of the data changes it contains are rolled back when the user disconnects. After a transaction is committed, executing one of the statements above starts a new transaction.

Implicit transaction mode remains in effect until the connection executes a SET IMPLICIT_TRANSACTIONS OFF statement, which returns the connection to autocommit mode. In autocommit mode, all individual statements are committed if they complete successfully.

The SQL Server Native Client OLE DB Provider for SQL Server and the SQL Server Native Client ODBC driver automatically set IMPLICIT_TRANSACTIONS to OFF when connecting. SET IMPLICIT_TRANSACTIONS defaults to OFF for connections with the SQLClient managed provider, and for SOAP requests received through HTTP endpoints.

When SET ANSI_DEFAULTS is ON, SET IMPLICIT_TRANSACTIONS is ON.

The setting of SET IMPLICIT_TRANSACTIONS is set at execute or run time and not at parse time.

Source:MSDN

×
×
  • Create New...