|
How do I ensure ACID transactions in TSQL? I'm having the database generate IDs through incrementation and store the most recent one in a field in a junction table. Basically, if you end up selecting one of the codes from said junction table, and the code is one where the DB Generates the ID instead of it being user supplied, it increments one to the existing, stored, most recent ID and passes that new one up to the server - my PM wants me to make very sure that we don't have two users trying to do this at the same time and something screwing it up. I've never actually had to worry about this before now, so I'd like to know what there is to make sure of this. I know SQL is in general good at this kind of thing but I've never needed to worry about the particularities before now.
|
# ¿ Jun 18, 2015 14:54 |
|
|
# ¿ Apr 29, 2024 06:49 |
|
Citizen Tayne posted:I believe the answer to this question is "you use Oracle." gently caress. That's a non-option right now.
|
# ¿ Jun 18, 2015 15:11 |
|
Citizen Tayne posted:Aren't you letting the DBMS handle the sequence generation for you? What you're asking here is pretty much a non-issue with any DBMS I've ever used. Being a dev and not a DBA I'm only well versed in making pretty simple queries and scripting out some basic stuff. I don't know if there are keywords to use in a stored procedure to do it atomically like I want, or not. We don't have a DBA and the only knowledge anyone has about ensuring this is a keyword to use in Oracle, which we're not using. For all I know MSSQL just does this by default but I don't know
|
# ¿ Jun 18, 2015 15:36 |
|
Citizen Tayne posted:I'm an Oracle dev so I'm not 100% sure about how SQL Server does it and it's been a long time since I touched it, but assuming that the DBAs did their job and made a sane database you don't need to worry about this in any modern DBMS I've ever used. You're trying to do things the hard way. Let the DB generate sequences and handle all of that for you. There are no DBAs, only zool. The database is not sane and poo poo like "we hit a linked oracle (lol) server for each and every row from this subquery in this big rear end report and it takes forever oh we're hitting it 140,000 times oh my god" or "we ran out of space and everything died and we're hemorrhaging money right now to the tune of millions a day" is a current recurring problem. OTOH I'll be 1000 miles away by the 6th of July
|
# ¿ Jun 18, 2015 15:41 |
|
Citizen Tayne posted:Sounds like you need to quit. I give the twoweeks tomorrow
|
# ¿ Jun 18, 2015 15:47 |
|
EDIT: CLEARLY SA COULD STAND TO HAVE TRANSACTIONS TOO
Space Whale fucked around with this message at 18:16 on Jun 18, 2015 |
# ¿ Jun 18, 2015 18:10 |
|
PleasingFungus posted:Also, I'd suggest googling AUTO_INCREMENT. Getting the feeling I need to go hang out with some DBA type people sometime since I basically just know how to grab and bundle poo poo and spit it out with a sproc, or just have EF do it for me.
|
# ¿ Jun 18, 2015 18:12 |
|
|
# ¿ Apr 29, 2024 06:49 |
|
Nth Doctor posted:If you're doing T-SQL (Microsoft SQL Server?) then you'll want to see if your using IDENTITY. But yeah: play minesweeper instead bro. pffffffft DCSS is way better
|
# ¿ Jun 18, 2015 23:17 |