May 9, 2012 at 1:56 pm
Stefan Krzywicki (5/9/2012)
Steve Jones - SSC Editor (5/9/2012)
WayneS (5/9/2012)
First of all, congrats to both of you for working together for this goal.But secondly.... seriously? fun working in the barn? mucking it out?
LOL, she's actually cleaning it up. She had a potential boarder come and mention that it was a bit of a mess and was wondering how she (the boarder) would organize her tack. So my wife is trying to clean out thing, move some to storage, and she's got me a few projects to build a bench and more saddle racks.
Actually mucking is relaxing work. Mindless, easy, a little sweat, and good time to think. We don't keep the horses in stalls, except in bad weather, so there usually isn't too much to clean up on a daily basis.
And really, how bad can it be? If I remember correctly from childhood reading, all you have to do is divert the local river and it washes everything clean!
No, that method only works for stables belonging to the King of Elis. As Elis doesn't currently have a King, it doesn't work at all just now.
Tom
May 9, 2012 at 1:59 pm
L' Eomot Inversé (5/9/2012)
Stefan Krzywicki (5/9/2012)
Steve Jones - SSC Editor (5/9/2012)
WayneS (5/9/2012)
First of all, congrats to both of you for working together for this goal.But secondly.... seriously? fun working in the barn? mucking it out?
LOL, she's actually cleaning it up. She had a potential boarder come and mention that it was a bit of a mess and was wondering how she (the boarder) would organize her tack. So my wife is trying to clean out thing, move some to storage, and she's got me a few projects to build a bench and more saddle racks.
Actually mucking is relaxing work. Mindless, easy, a little sweat, and good time to think. We don't keep the horses in stalls, except in bad weather, so there usually isn't too much to clean up on a daily basis.
And really, how bad can it be? If I remember correctly from childhood reading, all you have to do is divert the local river and it washes everything clean!
No, that method only works for stables belonging to the King of Elis. As Elis doesn't currently have a King, it doesn't work at all just now.
That seems oddly specific. Reminds me of legacy code...
--------------------------------------
When you encounter a problem, if the solution isn't readily evident go back to the start and check your assumptions.
--------------------------------------
It’s unpleasantly like being drunk.
What’s so unpleasant about being drunk?
You ask a glass of water. -- Douglas Adams
May 9, 2012 at 2:06 pm
Stefan Krzywicki (5/9/2012)
L' Eomot Inversé (5/9/2012)
Stefan Krzywicki (5/9/2012)
Steve Jones - SSC Editor (5/9/2012)
WayneS (5/9/2012)
First of all, congrats to both of you for working together for this goal.But secondly.... seriously? fun working in the barn? mucking it out?
LOL, she's actually cleaning it up. She had a potential boarder come and mention that it was a bit of a mess and was wondering how she (the boarder) would organize her tack. So my wife is trying to clean out thing, move some to storage, and she's got me a few projects to build a bench and more saddle racks.
Actually mucking is relaxing work. Mindless, easy, a little sweat, and good time to think. We don't keep the horses in stalls, except in bad weather, so there usually isn't too much to clean up on a daily basis.
And really, how bad can it be? If I remember correctly from childhood reading, all you have to do is divert the local river and it washes everything clean!
No, that method only works for stables belonging to the King of Elis. As Elis doesn't currently have a King, it doesn't work at all just now.
That seems oddly specific. Reminds me of legacy code...
That might maybe possibly be because your childhood reading was a legacy story?
Tom
May 9, 2012 at 3:15 pm
Just walk away, just walk away, just walk away,...
Party at the TitD!!!
Someone please bring some hay for the guard hippo.
May 9, 2012 at 4:33 pm
Sorry for the code, but I need a place to keep these solutions for a hypothetical problem on another thread.
Edit: Cursor code removed. Sorry for the blasphemy.
May 9, 2012 at 8:30 pm
Lynn Pettis (5/9/2012)
Sorry for the code, but I need a place to keep these solutions for a hypothetical problem on another thread.
Wow! Working with Oracle really did put the pinch on you. 😀
--Jeff Moden
Change is inevitable... Change for the better is not.
May 9, 2012 at 9:23 pm
Jeff Moden (5/9/2012)
Lynn Pettis (5/9/2012)
Sorry for the code, but I need a place to keep these solutions for a hypothetical problem on another thread.Wow! Working with Oracle really did put the pinch on you. 😀
Actually, it is he-who-is-without-clues that put the pinch on me. :w00t:
Trying a different tact to see if we can get him to finally give us what we need to help him.
May 9, 2012 at 9:24 pm
Jeff Moden (5/9/2012)
Lynn Pettis (5/9/2012)
Sorry for the code, but I need a place to keep these solutions for a hypothetical problem on another thread.Wow! Working with Oracle really did put the pinch on you. 😀
By the way, I never wrote a cursor while working with Oracle. Tried really hard not to do it.
May 9, 2012 at 11:26 pm
Your doing it wrong....
Lynn Pettis (5/9/2012)
-- 1st cursor-based solution, loops through all 2135 employee records and updates them all, some with a new salary:
DECLARE empCursor CURSOR FOR
SELECT
EmpId,
IsActive,
Salary,
Class
FROM
Emps;
OPEN empCursor;
DECLARE @EmpId INT,
@IsActive BIT,
@Salary DECIMAL(10,2),
@Class INT;
FETCH NEXT FROM empCursor INTO @EmpId, @IsActive, @Salary, @Class;
WHILE @@FETCH_STATUS = 0
BEGIN
IF @IsActive = 1
BEGIN
IF @Class = 1
SET @Salary = @Salary * 1.1
IF @Class = 2
SET @Salary = @Salary * 1.08
IF @Class = 3
SET @Salary = @Salary * 1.06
IF @Class = 4
SET @Salary = @Salary * 1.04
END
UPDATE Emps SET
Salary = @Salary
WHERE
EmpId = @EmpId;
FETCH NEXT FROM empCursor INTO @EmpId, @IsActive, @Salary, @Class;
END
CLOSE empCursor;
DEALLOCATE empCursor;
GO
DECLARE empCursor CURSOR FOR
SELECT
EmpId,
IsActive,
Salary,
Class
FROM
Emps;
OPEN empCursor;
DECLARE @EmpId INT,
@IsActive BIT,
@Salary DECIMAL(10,2),
@Class INT;
FETCH NEXT FROM empCursor INTO @EmpId, @IsActive, @Salary, @Class;
WHILE @@FETCH_STATUS = 0
BEGIN
IF @IsActive = 1
BEGIN
UPDATE Emps SET
Salary = Salary * 1.1
WHERE
EmpId = @EmpId;
AND Class = 1
UPDATE Emps SET
Salary = Salary * 1.08
WHERE
EmpId = @EmpId;
AND Class = 2
UPDATE Emps SET
Salary = Salary * 1.06
WHERE
EmpId = @EmpId;
AND Class = 3
UPDATE Emps SET
Salary = Salary * 1.04
WHERE
EmpId = @EmpId;
AND Class = 4
FETCH NEXT FROM empCursor INTO @EmpId, @IsActive, @Salary, @Class;
END
CLOSE empCursor;
DEALLOCATE empCursor;
GO
Why use one update where 4 will do?
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
May 9, 2012 at 11:32 pm
GilaMonster (5/9/2012)
Your doing it wrong.......
Why use one update where 4 will do?
Is this an Oracle thing? I've seen this a lot lately in Oracle code.
(and unfortunately, also in SSIS packages with OLE DB commands :crazy:)
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
May 9, 2012 at 11:37 pm
Koen Verbeeck (5/9/2012)
Is this an Oracle thing?
No, don't touch that myself.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
May 9, 2012 at 11:41 pm
GilaMonster (5/9/2012)
Koen Verbeeck (5/9/2012)
Is this an Oracle thing?No, don't touch that myself.
Normally I don't either, but someone has to convert all that PL/SQL to T-SQL...
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
May 10, 2012 at 12:46 am
Lynn Pettis (5/9/2012)
Jeff Moden (5/9/2012)
Lynn Pettis (5/9/2012)
Sorry for the code, but I need a place to keep these solutions for a hypothetical problem on another thread.Wow! Working with Oracle really did put the pinch on you. 😀
Actually, it is he-who-is-without-clues that put the pinch on me. :w00t:
Trying a different tact to see if we can get him to finally give us what we need to help him.
I've found that when someone can shake off multiple vollies of high velocity, point blank range originated and numbered porkchops aimed squarely at the soft parts of the calcium knob, it's time to move on. You might actually hurt the guy. 😉
--Jeff Moden
Change is inevitable... Change for the better is not.
May 10, 2012 at 12:49 am
Koen Verbeeck (5/9/2012)
GilaMonster (5/9/2012)
Koen Verbeeck (5/9/2012)
Is this an Oracle thing?No, don't touch that myself.
Normally I don't either, but someone has to convert all that PL/SQL to T-SQL...
Neh... get the specs and rewrite it. It'll be easier.
--Jeff Moden
Change is inevitable... Change for the better is not.
May 10, 2012 at 12:53 am
Jeff Moden (5/10/2012)
Koen Verbeeck (5/9/2012)
GilaMonster (5/9/2012)
Koen Verbeeck (5/9/2012)
Is this an Oracle thing?No, don't touch that myself.
Normally I don't either, but someone has to convert all that PL/SQL to T-SQL...
Neh... get the specs and rewrite it. It'll be easier.
Unfortunately, the specs are worse then the code.
Anyway, already replaced 4 cursors this morning.
My client will be blown away when it's finished 😀
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
Viewing 15 posts - 35,986 through 36,000 (of 66,712 total)
You must be logged in to reply to this topic. Login to reply