Viewing 15 posts - 1,126 through 1,140 (of 2,171 total)
Here is another approach with no ridiculus tally table pinned into memory, where more vital information can be stored and used.
With the original sample data, there is now only 67...
January 31, 2008 at 3:06 pm
Mike Nuessler (1/31/2008)
Interesting.I am going to modify your suggestion as required for my needs and run it on production data against my modified Sergiy method and see what happens.
When...
January 31, 2008 at 12:32 pm
I used
CREATE CLUSTERED INDEX IX_Yak ON TestData (StaffName, ReviewDate)
Please reread my previous post with timings and execution plans involved.
My suggestion only needs 32 reads whereas Sergiy needs 4385 reads...
January 31, 2008 at 9:02 am
What? I have only two table scans. And if you index the #TestData table properly you will get two clustered index scans only!
Peso with 32 reads
|--Compute Scalar
...
January 31, 2008 at 8:44 am
And this how you do it in SQL Server 2005 with only valid member (member has a reviewdate in wanted range)SELECTCASE WHEN u.RecID = 1 THEN u.StaffName ELSE '' END...
January 31, 2008 at 8:25 am
This is how you do it in SQL Server 2005 with all members includedSELECTCASE WHEN u.RecID = 1 THEN u.StaffName ELSE '' END AS StaffName,
MAX(CASE WHEN u.ReviewDate LIKE '2006%' THEN...
January 31, 2008 at 8:24 am
Why use UPDATE at all? Or use a function? This is possible to do in a single query.
And still have some options to include or exclude "non-valid" members!
SELECTCASE WHEN u.theIndex...
January 31, 2008 at 7:56 am
Replace DISTINCT with TOP 1 in the correlated subquery.
January 31, 2008 at 6:52 am
DBCC CHECKIDENT can be used to reseed the identity value.
January 28, 2008 at 4:35 am
Use OPENROWSET function together with INNER JOIN.
January 28, 2008 at 3:42 am
Or create a unique constraint (or check the ignore duplicate key) on the existing index.
then you always can insert directly and if a record exists, you will get a warning.
January 23, 2008 at 1:55 am
LEN() function is NOT counting trailing spaces.
DATALENGTH() does.
Are you the spaces really are spaces (ascii value 32)?
Make sure they are not hard-spaces (ascii value 160).
January 22, 2008 at 2:56 am
I don't think points are valid date separator for style 103.
January 22, 2008 at 1:19 am
I don't think points are valid date separator for style 103.
January 22, 2008 at 1:19 am
Viewing 15 posts - 1,126 through 1,140 (of 2,171 total)