Viewing 15 posts - 106 through 120 (of 356 total)
I believe that you should be using the RANK function rather than ROW_NUMBER, otherwise participants with the same end time may be unfairly awarded a different number of points. In...
August 3, 2009 at 11:47 am
Sorry! - that'll teach me to submit an answer without testing it.
However, a minor change fixes the problem I think.
WHERE (a.START_DATE = DATEADD(day, -14, GETDATE()))
Here's a variation that removes the...
August 3, 2009 at 10:46 am
If you define the WHERE clause like this:
WHERE (a.START_DATE >= DATEADD(day, -14, GETDATE()))
AND (a.END_DATE <= DATEADD(day, 14, GETDATE()))
you should get performance improvement as the DATEADD expressions will...
August 3, 2009 at 9:29 am
I haven't quite reproduced your required results, but then I don't believe that those results are really what you want!
Here is the TSQL to set up some test data....
July 24, 2009 at 4:07 pm
Try this FOR XML EXPLICIT query.
SELECT 1 AS Tag,
0 AS Parent,
NULL AS [REQUISITIONS!1],
NULL AS [RECORD!2!EMPLOYEEID!element],
NULL AS [RECORD!2!FIRSTNAME!element],
...
July 20, 2009 at 6:47 pm
Of course the real problem is the that the name is not stored in separate fields to begin with.
Agreed.
July 6, 2009 at 12:10 pm
I've created a #Sales table and populated it with some test data - providing a TSQL script to generate the test data is the preferred method of presenting test data...
July 2, 2009 at 5:32 pm
3 questions:
Q1. Is it possible that for a given row the height column might be vaued but the weight column may be null, or vice versa? Or are the height...
July 1, 2009 at 5:28 pm
REVERSE is one of the less performant string functions in TSQL, so this alternative expression calls REVERSE only once.
SELECT RIGHT(@nam, CHARINDEX(' ', REVERSE(@nam)) - 1)
The expression above and also some...
July 1, 2009 at 2:49 pm
You might wish to cast to a float or decimal value before calculating the average.
;WITH AccItem AS (
SELECT itemId,
ROW_NUMBER() OVER (ORDER...
June 16, 2009 at 1:50 pm
I think you want the average number of rows between consecutive rows with the same itemId with the row order defined by the date column, rather than the average number...
June 16, 2009 at 6:31 am
It is possible to convert an YYYYMMDD integer representation of a date directly to a datetime value as follows:
SELECT DATEADD(year, run_date / 10000 - 1900,
DATEADD(month, (run_date...
June 15, 2009 at 1:15 pm
I'm guessing that the required start date is for the current year and that the varchar column that stores the month and day is consistently in the format M/D where...
June 3, 2009 at 3:12 pm
Lookup DATEDIFF TSQL function in SQL Server Books Online
May 29, 2009 at 12:47 pm
I'm not entirely sure what you mean, but assuming you have a single string that comprises 2 sequences of characters that do not include any space characters separated by a...
May 29, 2009 at 12:31 pm
Viewing 15 posts - 106 through 120 (of 356 total)