Click here to Skip to main content
15,921,840 members
Home / Discussions / Database
   

Database

 
Questionhow to generalize SQL queries Pin
puppiesLover20-Jun-03 8:04
puppiesLover20-Jun-03 8:04 
AnswerRe: how to generalize SQL queries Pin
Mike Osbahr23-Jun-03 4:48
Mike Osbahr23-Jun-03 4:48 
GeneralAdd host to MySQL 4 Pin
Matt Newman19-Jun-03 7:16
Matt Newman19-Jun-03 7:16 
GeneralRe: Add host to MySQL 4 Pin
ZoogieZork22-Jun-03 7:19
ZoogieZork22-Jun-03 7:19 
GeneralPopulate schema to database Pin
Jim Stewart19-Jun-03 6:59
Jim Stewart19-Jun-03 6:59 
GeneralCreateDatabase Pin
Jim Stewart19-Jun-03 6:50
Jim Stewart19-Jun-03 6:50 
GeneralRe: CreateDatabase Pin
Joshua Nussbaum27-Jun-03 8:51
Joshua Nussbaum27-Jun-03 8:51 
GeneralTransactions Pin
Megan Forbes19-Jun-03 5:03
Megan Forbes19-Jun-03 5:03 
We use transactions in many of our stored procedures, and it seems I've either been lulled into a false sense of security, or am implementing them incorrectly.

We have an sp, called from an ASP page. It, briefly, does the following:

Select from table1 into a cursor

Begin Transaction

Insert into table2
exec sp_2
exec sp_3
Insert into table3
Delete from table1 (data collected and now inserted into the new tables)

IF @@error = 0
COMMIT TRANSACTION
ELSE
ROLLBACK TRANSACTION

I was under the impression this meant that either everything in the transaction would occur, or nothing. It's critical (for our data) that it works this way. However, when setting up a new server over the last couple of days I carelessly forgot to put permissions on a couple of the tables (it's a staging server, not a live one). This resulted in the delete (final item in the transaction) occuring, but none of the inserts occurred. Very worrying. Surely an error should have been generated when the inserts weren't allowed, and everything, including the delete, should have been rolled back?

As I say, it's not a problem, all nicely fixed once I realised the error of my ways. But I am curious about this. Is there perhaps something I am overlooking in my transactions? Or an option which should be set on SQL Server 2000 to keep transactions behaving the way I want them to?

Thanks for any info Smile | :)






To honor you, and your sick games, this smiley Poke tongue | ;-P will now represent licking chocolate off candy - David Chamberlain
GeneralRe: Transactions Pin
basementman19-Jun-03 8:44
basementman19-Jun-03 8:44 
GeneralRe: Transactions Pin
Megan Forbes19-Jun-03 22:18
Megan Forbes19-Jun-03 22:18 
GeneralRe: Transactions Pin
Arjan Einbu19-Jun-03 12:14
Arjan Einbu19-Jun-03 12:14 
GeneralRe: Transactions Pin
Megan Forbes19-Jun-03 22:19
Megan Forbes19-Jun-03 22:19 
GeneralRe: Transactions Pin
Arjan Einbu19-Jun-03 22:30
Arjan Einbu19-Jun-03 22:30 
GeneralRe: Transactions Pin
basementman20-Jun-03 3:58
basementman20-Jun-03 3:58 
GeneralRe: Transactions Pin
Arjan Einbu20-Jun-03 11:53
Arjan Einbu20-Jun-03 11:53 
GeneralNotesSQL using.NET, OdbcException Pin
sinus-c18-Jun-03 0:35
susssinus-c18-Jun-03 0:35 
GeneralRe: NotesSQL using.NET, OdbcException Pin
sinus-c18-Jun-03 1:52
susssinus-c18-Jun-03 1:52 
GeneralSql/osql help Pin
DxSolo17-Jun-03 8:15
DxSolo17-Jun-03 8:15 
GeneralRe: Sql/osql help Pin
basementman17-Jun-03 14:24
basementman17-Jun-03 14:24 
GeneralRe: Sql/osql help Pin
DxSolo18-Jun-03 3:15
DxSolo18-Jun-03 3:15 
GeneralRe: Sql/osql help Pin
basementman18-Jun-03 4:12
basementman18-Jun-03 4:12 
GeneralRe: Sql/osql help Pin
DxSolo18-Jun-03 5:06
DxSolo18-Jun-03 5:06 
GeneralRe: Sql/osql help Pin
Arjan Einbu18-Jun-03 23:20
Arjan Einbu18-Jun-03 23:20 
GeneralSeveral queries in single ODBC command Pin
jpeg17-Jun-03 4:46
jpeg17-Jun-03 4:46 
GeneralRe: Several queries in single ODBC command Pin
basementman17-Jun-03 5:42
basementman17-Jun-03 5:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.