Monday, July 10, 2006

What I do for a living...(example one)

Sometimes I write stuff like this...

-- Retrieve the EwaResponse_DMTrigger(s) that currently exist for P&G and store it in a temp table for later comparison --

CREATE TABLE #ExistingEwaResponse_DMTriggers (
EwaResponseID INT,
DMTriggerID INT,
UserID INT
)

INSERT INTO #ExistingEwaResponse_DMTriggers

SELECT
EwaResponse_DMTrigger.EwaResponseID,
EwaResponse_DMTrigger.DMTriggerID,
EwaResponse.UserID
FROM
EwaResponse_DMTrigger WITH (NOLOCK)
INNER JOIN
EwaResponse WITH (NOLOCK)
ON EwaResponse.EwaResponseID = EwaResponse_DMTrigger.EwaResponseID
WHERE
EwaResponse_DMTrigger.EwaResponseID IN (

SELECT
EwaResponse.EwaResponseID
FROM
EwaResponse WITH (NOLOCK)
INNER JOIN
Users WITH (NOLOCK)
ON Users.UserID = EwaResponse.UserID
INNER JOIN
Site WITH (NOLOCK)
ON Site.SiteID = Users.SiteID
WHERE
Site.CompanyID = 474)

ORDER BY
EwaResponse_DMTrigger.EwaResponseID DESC
---------------------------------

-- Execute spGetDMForm for all P&G EwaResponse(s) --
DECLARE
@EwaResponseID INT,
@UserID INT

DECLARE
LOOPYcursor CURSOR FOR

SELECT
EwaResponse.EwaResponseID,
EwaResponse.UserID
FROM
EwaResponse WITH (NOLOCK)
INNER JOIN
Users WITH (NOLOCK)
ON Users.UserID = EwaResponse.UserID
INNER JOIN
Site WITH (NOLOCK)
ON Site.SiteID = Users.SiteID
WHERE
Site.CompanyID = 474
ORDER BY
EwaResponse.EwaResponseID DESC

OPEN LOOPYcursor

FETCH NEXT FROM LOOPYcursor INTO
@EwaResponseID,
@UserID

WHILE @@Fetch_Status = 0
BEGIN

EXECUTE [dbo].[spGetDMForm] @EwaResponseID, @UserID, null

FETCH NEXT FROM LOOPYcursor INTO
@EwaResponseID,
@UserID

END

CLOSE LOOPYcursor

DEALLOCATE LOOPYcursor
---------------------------------

-- Retrieve the EwaResponse_DMTrigger(s) that are new for P&G --
SELECT
CurrentEwaResponse_DMTrigger.EwaResponseID,
CurrentEwaResponse_DMTrigger.DMTriggerID,
CurrentEwaResponse_DMTrigger.UserID
FROM
(
SELECT
EwaResponse_DMTrigger.EwaResponseID,
EwaResponse_DMTrigger.DMTriggerID,
EwaResponse.UserID
FROM
EwaResponse_DMTrigger WITH (NOLOCK)
INNER JOIN
EwaResponse WITH (NOLOCK)
ON EwaResponse.EwaResponseID = EwaResponse_DMTrigger.EwaResponseID
) AS CurrentEwaResponse_DMTrigger
WHERE
CurrentEwaResponse_DMTrigger.EwaResponseID IN
(
SELECT
EwaResponse.EwaResponseID
FROM
EwaResponse WITH (NOLOCK)
INNER JOIN
Users WITH (NOLOCK)
ON Users.UserID = EwaResponse.UserID
INNER JOIN
Site WITH (NOLOCK)
ON Site.SiteID = Users.SiteID
WHERE
Site.CompanyID = 474
)
AND NOT EXISTS
(
SELECT
EwaResponseID,
DMTriggerID,
UserID
FROM
#ExistingEwaResponse_DMTriggers
WHERE
#ExistingEwaResponse_DMTriggers.EwaResponseID =
CurrentEwaResponse_DMTrigger.EwaResponseID

AND #ExistingEwaResponse_DMTriggers.DMTriggerID =
CurrentEwaResponse_DMTrigger.DMTriggerID

AND #ExistingEwaResponse_DMTriggers.UserID =
CurrentEwaResponse_DMTrigger.UserID

)
ORDER BY
CurrentEwaResponse_DMTrigger.EwaResponseID DESC
---------------------------------

-- Drop the temp table created --
DROP TABLE #ExistingEwaResponse_DMTriggers
---------------------------------

Thursday, June 22, 2006

Truck Mod

The greatest custom mod I could ever make to my truck.

Monday, June 05, 2006

A Painful Day

Today it physically pains me to be at work and listening to the conversations that are going on.

Wednesday, May 31, 2006

1 Timothy 6:7-11



"For we have brought nothing into the world, so we cannot take anything out of it either. And if we have food and covering, with these we shall be content. But thos who want to get rich fall into temptation and a snare and many foolish and harmful desires which plunge men into ruin and destruction. For the love of money is a root of all sorts of evil, and some by longing for it have wandered away from the faith, and pierced themselves with many a pang. But flee from these things, you man of God; and pursue righteousness, godliness, faith, love, perseverance and gentleness." 1 Timothy 6:7-11

Monday, May 22, 2006

Galatians 2:20


"I have been crucified with Christ and I no longer live, but Christ lives in me. The life I live in the body, I live by faith and in the son of God, who loved me and gave himself for me." Galatians 2:20 (NIV - New International Version)

"I have been crucified with Christ; and it is no longer I who live, but Christ lives in me; and the life which I now live in the flesh I live by faith in the Son of God, who loved me, and delivered himself up for me." Galatioans 2:20 (NASB - New American Standard Bible)

"I am crucified with Christ: nevertheless I live; yet not I, but Christ liveth in me: and the life which I now live in the flesh I live by the faith of the Son of God, who loved me, and gave himself for me." Galatians 2: 20 (KJV - King James Version)

"With Christ I have been co-crucified; and live no more I, but lives in me Christ; and what now I live in [the] flesh, by faith I live of(in) the Son of God loving me and giving up himself on behalf of me." (Greek to English Translation - 21st edition of Eberhard Nestle's Novum Testamentum Graece)