In PostgreSQL the ‘psql’ client lets you run interactive transactions, e.g.
Begin;
Update ...
Select ...
(oops)
rollback
Where is the same thing in SQL Server?
In PostgreSQL the ‘psql’ client lets you run interactive transactions, e.g.
Begin;
Update ...
Select ...
(oops)
rollback
Where is the same thing in SQL Server?
osql (http://msdn.microsoft.com/en-us/library/aa214012%28SQL.80%29.aspx) or SQLCMD (http://msdn.microsoft.com/en-us/library/ms162773.aspx) are the equivalent command line tools in SQL Server. I guess Management Studio (SSMS), might be considered the client as well.
SSMS is a GUI client.
SQLCMD and OSQL are command line tools.
Some T-SQL editors include a test mode that will wrap your statements in BEGIN / ROLLBACK statements for you (with varying degrees of protection to what you are doing within those statements). SSMS certainly doesn't have it built in - I'm not sure if any plug-ins give you that functionality off the top of my head.
For error checking purposes you might want to look into the TRY/CATCH block:
http://msdn.microsoft.com/en-us/library/ms175976.aspx
But in T-SQL (Transact SQL) we do have the ROLLBACK TRANSACTION like you posted above:
@Matt @phil I think you're looking for: SET IMPLICIT_TRANSACTIONS ON
No one has followed this question yet.