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 2000 Forums
 SQL Server Development (2000)
 SQL on a sunny Friday afternoon in Seattle???

Author  Topic 

AjarnMark
SQL Slashing Gunting Master

3246 Posts

Posted - 2001-08-17 : 15:38:24
It's Friday afternoon, and the sun is shining in Seattle, which is a rare occurrence. I'm staring at this code and the synapses just aren't firing like they used to, so I'll put it up for a quick answer by the masters...

Here's the code:
 INSERT INTO Table1 (EventID, Title, Description)
SELECT EventID, Title, Description FROM Table2 WHERE MoveFlag = 1

UPDATE Table2 SET MoveFlag = 0 WHERE MoveFlag = 1


What happens when a new record is inserted/updated into Table2 setting MoveFlag = 1 by another user between the execution of the two statements above? Will putting this in a TRANS (of course it will be in a sproc) prevent the new record from being changed back to MoveFlag=0 without getting inserted into Table1?

------------------------------------------------------------------
Contractor$ never die, they just leave for higher-paying project$.
   

- Advertisement -