Viewing 15 posts - 39,766 through 39,780 (of 59,072 total)
lmu92 (2/14/2010)
Shouldn't it be on (EmployeeID, SalaryDate) instead of RowID?
What would happen with rows like:
SELECT 1, 12, '20050101',...
--Jeff Moden
Change is inevitable... Change for the better is not.
February 14, 2010 at 6:52 pm
Do it all at once and without a triangular join...
CREATE CLUSTERED INDEX IX_SalaryHistory_RowID
ON #SalaryHistory (RowID)
DECLARE @PrevSalaryAmount MONEY
UPDATE #SalaryHistory
SET @PrevSalaryAmount...
--Jeff Moden
Change is inevitable... Change for the better is not.
February 14, 2010 at 5:30 pm
As a side bar, I probably wouldn't ever have a period table based on the last whole day of the month... if "times" ever creep into the statement table, then...
--Jeff Moden
Change is inevitable... Change for the better is not.
February 14, 2010 at 10:28 am
lmu92 (2/14/2010)
Looks like I'm getting too addicted to CTEs... 😛
No... don't think that for a minute. The CTE's you wrote are a great exhibition of "Divide'n'Conquer". They run...
--Jeff Moden
Change is inevitable... Change for the better is not.
February 14, 2010 at 9:40 am
SQL Compare does something in the background to check dependencies. You could probably do something similar but, I have to ask, why don't you want to use SQL Compare...
--Jeff Moden
Change is inevitable... Change for the better is not.
February 13, 2010 at 10:43 pm
Heh... looks like Lutz was right.
In that case, we can keep this really short...
;
WITH cteAllDates AS
(
SELECT s.Dept, s.Acct, DATEADD(mm,DATEDIFF(mm,0,p.Period),0) AS PeriodStart, p.Period, 0 AS Credit, 0 AS Debit
...
--Jeff Moden
Change is inevitable... Change for the better is not.
February 13, 2010 at 10:26 pm
"Best Practices"... heh... all I'm going to say about that subject is "It Depends". 😉
--Jeff Moden
Change is inevitable... Change for the better is not.
February 13, 2010 at 8:36 pm
Ummmm.... so what do you want to do if the underlying tables don't exist?
--Jeff Moden
Change is inevitable... Change for the better is not.
February 13, 2010 at 7:03 pm
haggisns (2/8/2010)
I have the following basic data:
rowid orderid cost
1 1 10
2...
--Jeff Moden
Change is inevitable... Change for the better is not.
February 13, 2010 at 6:56 pm
surya-434952 (2/12/2010)
... i need to insert credit and debit values as '0'
That's a bit of an ambiguous statement as it is... WHERE do you want to insert the zero values?...
--Jeff Moden
Change is inevitable... Change for the better is not.
February 13, 2010 at 5:23 pm
Lutz,
I'm possibly missing the bubble here... why wouldn't the following two entries be added together for a single "period"?
SELECT '2','2','20090205','200','80' UNION ALL
SELECT '2','2','20090207','200','80'
--Jeff Moden
Change is inevitable... Change for the better is not.
February 13, 2010 at 4:13 pm
You bet... thanks for the feedback, UT.
--Jeff Moden
Change is inevitable... Change for the better is not.
February 13, 2010 at 2:54 pm
mark.pleasance (2/11/2010)
I'm not a lumberjack, or a Furtrader,
and I don't live in an igloo, or eat blubber or own a dogsled.
And I...
--Jeff Moden
Change is inevitable... Change for the better is not.
February 13, 2010 at 2:36 pm
As yet another side bar, an "accidental cross join" can also be in the form of what is known as a "Triangular Join". Take a look at the following...
--Jeff Moden
Change is inevitable... Change for the better is not.
February 13, 2010 at 12:20 pm
UT- (2/12/2010)
Jeff Moden (2/12/2010)
Accidental cross joins are actually quite common and are a typical cause of TempDB going nuts.
Thanks Jeff, can you please give me an example of "Accidental" cross...
--Jeff Moden
Change is inevitable... Change for the better is not.
February 13, 2010 at 12:05 pm
Viewing 15 posts - 39,766 through 39,780 (of 59,072 total)