Viewing 15 posts - 1,336 through 1,350 (of 2,171 total)
August 29, 2007 at 11:40 am
If you compare the speed with your code above, and this
SELECT DATEADD(HOUR, DATEDIFF(HOUR, 0, DateCol), 0) AS YYYYMMDDHH,
COUNT(*)
FROM WebHak_Applicant
GROUP
August 29, 2007 at 8:44 am
Why didn't you say so from the beginning?
Read my article here http://www.sqlservercentral.com/columnists/plarsson/pivottableformicrosoftsqlserver.asp
It has everything you need, including multiple aggregations.
August 29, 2007 at 8:42 am
CAST(STR(Date_Created) + ' ' + STUFF(STUFF(CONVERT(CHAR(6), Time_Create)), 5, 0, ':'), 3, 0, ':') AS DATETIME)
August 29, 2007 at 8:41 am
BTW, are you using SQL Server 2000 or SQL Server 2005?
August 29, 2007 at 8:37 am
DECLARE @ToDate DATETIME,
@FromDate DATETIME,
@ChannelID NUMERIC(9)
SELECT @ToDate = '01/01/2007',
@FromDate = '01/01/2007'
August 29, 2007 at 8:36 am
DECLARE
@Sample TABLE (ID INT IDENTITY, yyyy INT,...
August 29, 2007 at 8:31 am
Change the algorithm.
When inserting, check if there is any record for same year. if there is, just add +1 to maximum NumberInYear for that year.
If a record is not found,...
August 29, 2007 at 8:27 am
Yes, you can add an INDEX HINT to your query
WITH (INDEX (ix_blablabla))
August 29, 2007 at 6:19 am
SELECT v.Number + 1 AS Hit,
CONVERT(CHAR(5), DATEADD(HOUR, v.Number, 0), 108) + ' to ' + CONVERT(CHAR(5), DATEADD(HOUR, v.Number + 1, 0), 108) AS [Hit...
August 29, 2007 at 5:40 am
I believe that if OP is new (non-experienced) to SQL Server, he or she is better of learning the proper [ansi join] way directly, instead of learning them CORRELATED SUBQUERIES,...
August 29, 2007 at 4:36 am
No idea why the above code does not work, since I don't have access to the functions.
However, this is MUCH more efficient way to do the same thing!
SELECT
August 29, 2007 at 2:50 am
Good luck!
Most often, the CASE statements are faster than the PIVOT too, in my experience.
August 29, 2007 at 2:14 am
Viewing 15 posts - 1,336 through 1,350 (of 2,171 total)