Answer by Grant Fritchey
It's all part of a single transaction, so the values are not being modified first, they're being modified at the same time. Any reads are gathered and you won't see the affects of writes until they're...
View ArticleAnswer by Grant Fritchey
Thinking about it some more, it might even be a valid place for a trigger, although, I'd still rather see it in two, controlled steps. I'm not a fan of triggers.
View ArticleAnswer by Cyborg
I agree with the above answers, consider this example DECLARE @temp TABLE (ID INT , Amt INT, Dt DATE) INSERT INTO @temp SELECT 1,1000,GETDATE() UPDATE @temp SET Amt = Amt+1000, Dt = CASE WHEN Amt =...
View ArticleAnswer by Doiremik
thanks lads. yes indeed I did think on a trigger but the actual implementation is a bit more complex and thats why I do it in the update instead of a trigger as I have some more business rules. I just...
View ArticleAnswer by Doiremik
ok, you asked for it lol.. here is the actual statement. It does basically what the other simple statement does. I get in a value which can be negative or positive but I just use the abs on it. I'm...
View ArticleAnswer by Doiremik
OK... just want to throw this out there... is there any chance that a call to GETUTCDATE() could return NULL. I know its a bit mad to think but it would explain the issue alright. What I was going to...
View Article