Viewing 15 posts - 5,296 through 5,310 (of 7,614 total)
CELKO (3/12/2015)
Since BIGINT is larger than the number of atoms in the universe, we do not use it very often.
No, not even close. There are at least 10^78...
March 16, 2015 at 3:00 pm
ricardo_chicas (3/16/2015)
If I let the query run forever since it is scanning the whole table
Hmm, isn't it scanning the nonclustered index rather than the whole table (clustered index)?
Yeah just the...
March 16, 2015 at 2:08 pm
shezi (3/16/2015)
ScottPletcher (3/16/2015)
...
ORDER BY CASE WHEN pr.hours > 0 THEN 1 ELSE 2 END, Name
Excellent.
One final Question. The Employee table also has status. Active or Terminated. I want...
March 16, 2015 at 2:06 pm
ORDER BY CASE WHEN pr.hours > 0 THEN 1 ELSE 2 END, Name
March 16, 2015 at 1:29 pm
Yep; much safer to use "> 0" rather than checking for the specific bit value 🙂
March 16, 2015 at 1:01 pm
Quirky update requires a clustered index that conforms to the computation being done.
March 16, 2015 at 1:00 pm
I have the same concerns. SQL should be better at using the clustered index when it applies ... we went to the trouble to get the best clustered index...
March 16, 2015 at 12:58 pm
I wasn't sure which table "valid_payroll" is in, so I guessed "Employee". If it's not, adjust the code accordingly. Btw, always use a table alias on every column...
March 16, 2015 at 12:48 pm
Dan121 (3/16/2015)
March 16, 2015 at 12:39 pm
Let me point out that using a char-based column for a date is a very bad idea. Not only does it take more space but it will get garbage...
March 12, 2015 at 1:26 pm
Here's the code with the tally table built in as a derived table rather than a CTE.
Note that we need an actual date computation to compute the first desired Friday...
March 12, 2015 at 10:46 am
First, let's note that we need an actual date computation only for the first Friday. For the subsequent Fridays, we can simply add 7 more days.
Note: I...
March 12, 2015 at 10:36 am
TryingToLearn (3/12/2015)
It has one column( identity column) as the PK and...
It has another column is used as CI
Is there ever a benefit to this approach?
Yes; indeed, that is the...
March 12, 2015 at 10:16 am
Edit: Bolded mods to original code.
BEGIN TRANSACTION
DECLARE @DEPTNBR BIGINT
SELECT TOP (1) @DEPTNBR = DEPTNBR
FROM DEPARTMENT_DETAILS WITH (UPDLOCK,READPAST)
WHERE STATUS = 1
UPDATE DEPARTMENT_DETAILS
SET STATUS = 0
WHERE DEPTNBR =...
March 11, 2015 at 9:58 am
Viewing 15 posts - 5,296 through 5,310 (of 7,614 total)