Lighter side of a TSQL query :: Wedding Style
Writing a better TSQL query will get you better performance, in terms of system & life-style too.
Here is the email I received from my BIL, too get a lighter side of blending a TSQL query as Stored Procedure (from а BrideGroom) .... guess what would be end result of that Stored Procedure!!
----------------
Connect to MarriageLookings SQL instance and write the following Stored Procedure to execute:
CREATE PROCEDURE BeforeMarriage (BrideGroom Male (25) ,Bride Female(20) )
AS
BEGIN
SELECT Bride FROM [india_Brides] WHERE FatherInLaw = 'Millionaire'
AND Count(Car) > 20
AND HouseStatus ='ThreeStoreyed'
AND BrideEduStatus IN ('Masters Degree','B.TECH' ,'B.E' ,'Degree' ,'MCA' ,'MiBA')
AND Having Brothers= Null AND Sisters =Null
END
GO
CREATE PROCEDURE AfterMarriage (FatherInLawBankAccount(25) , MyBankAccount(20) )
AS
BEGIN
SELECT Gold ,Cash,Car,BankBalance FROM FatherInLaw
UPDATE MyBankAccout SETMyBal = MyBal + FatherInLawBal
UPDATE MyLocker SET MyLockerContents = MyLockerContents + FatherInLawGold
INSERT INTO MyCarShed VALUES('BMW')
END
GO
----------------------------------------------------------------------
Compiled both the stored procedures and executed, awaiting results!!!
!
!
!
!
!
!
!
!
!
!
!
!
!
Then the BrideGroom writes the below query as a reply:
DROP BrideGroom;
Commit;
Hope you get the lighter side of the above TSQL query.
**__________________________________**
SQL Server MVP, Sr. DBA & industry expert.
-
Knowledge is of two kinds. We know a subject ourselves or we know where we can find information on it. It is also a power and you will gain by sharing it.