- The alarm didn't go off.
Kidding... it really did. Unfortunately.
6:54am
To his credit, the Bald One left me here again, but with a project...
automate some stuff in a database.
6:55am
I'm no one to be triffled with, I
thought. I went back to sleep for a while longer.
11:21am
Housekeeping woke me, quite rudely. I was dreaming I was a
Confederate soldier in Charleston in 1864. The war was raging,
and I found myself distracted by a brief, but torrid, flirtation with...
ah, never mind. Anyway, I was awoken.
11:30am
Broom Hilda having departed, I
set about my assigned task. It seems Tubby thinks I can communicate
in SQL as well as HTML. False, of course.
1:21pm
By reading online documentation, I manage to create an insert statement
that does what it's supposed to do. For one entry. But it's a start.
The South wasn't rebuilt overnight, after all, after the War of Northern
Aggression ended.
1:59pm
No luck making further progress. I
figured people who write code eat a lot of junk food. I should
try it.
2:00pm
I gander into the fridge. Hello... what's this? Instead of low calorie,
we have
this. Funny.
5:57pm
I refuse to do anything else on
this little project. It's not going well, and I'm just not
clever enough to make a go of it. (If you are, just yell.)
The project (using T-SQL) is to insert one row into Table "A"
for the results of a select statement from Table "B".
Such that the select statement identifies 10 results in Table B
that meet the criteria, a total of 10 rows need to be inserted into
Table "A". Along with that insert is some other
variables, to be plugged in at the time of insert. If you
can read SQL code at all, it's likely going to be apparent that
I cannot write it, eh? Here's what I've got after 6½ hours:
/************************************************************************/
/* Posting Monthly PTO accruals to the dept time off database
*/
/* Created by Frank Duck on behalf of Tubby
*/
/* Created on 11 September 2002
*/
/* dept_post_monthly_pto.sql
*/
/************************************************************************/
Declare
@PostedBy int,
@PeriodEarned smalldatetime,
@Employee int
select
@PeriodEarned = '09/30/02', -- ENTER the date
of the month you're posting time for
@PostedBy = 98289 -- 98289 used to indicate system
functions for the TimeOff db
select EmplId from tbl_Employee where EmplId > 2000 and EmplId <
99999 and Status = 'Active'
/*set -- commented out... it no workie
@Employee */
insert into tbl_Request (EmpId,Date,TimeType,Comments,RptHR,DateCreated,Hours,Editor)
values(1935,@PeriodEarned,'PTO','Accrual',1,getdate(),14,@PostedBy)
insert into tbl_Request (EmpId,Date,TimeType,Comments,RptHR,DateCreated,Hours,Editor)
values(@Employee,@PeriodEarned,'PTO','Accrual',1,getdate(),10,@PostedBy)
In the second insert, the objective is to get the 10 records (for
example) that met the criteria of being between 2000 and 99999,
and then insert one row for each of those ten records into the tbl_Request,
so the process would create a total of 11 new rows (the first insert
on 1935, and then the 10 results of the second select statement.
Yes, it made my head explode, too. HTML, now that
makes sense.
7:47pm
Tubby, being more clever than most, returns home to announce
that he didn't stop for food on the way home. No sir -- he
stopped for food before getting on the train. I'm stuck again
with Pringles, and either local tab water or low joule soda.
Both sound equally unappealing right now...
8:02pm
In a fit of avoidance (don't want
to engage in chit-chat with Baldie), I fuss with the laptop to watch
a DVD.
8:23pm
I'm ready to call it quits on the DVD. There's a projector
and TV, allegedly, at the boy's office; I may go in on Friday and
make use of it.
9:48pm
Here's a tough one to figure out --
the boy is tuckered out and going to bed. I've done most of
his chore, and am exhausted, and he's already tucked himself in, has
told himself a bed-time story of a fairy princess trapped in a castle
guarded by an evil dragon stricken with dysentery, and of a gallant,
balding knight who rescues her. Of course, being neurotic as
he is, once rescued, he realizes that their children would probably
be blonde and probably right-handed; for some reason, that troubles
him, and he leaves her with the dragon and gallops off. I suspect
someone will sleep fitfully tonight...