Its an ugly hack but this works.
SELECT *
FROM TestEmp E LEFT OUTER JOIN
(SELECT DL.DateItem,DL.ID,DL.EmpId,DL.Note
FROM TestDateLog DL INNER JOIN
(SELECT MIN(DATEADD(ms,ID,DateItem)) AS DateItem, EmpID
FROM TestDateLog
GROUP...
Well say note is a text field.
ALTER TABLE TestDateLog ALTER COLUMN Note text NULL
The text, ntext, and image data types are invalid in this subquery or aggregate expression.
And what if there are more columns than just Note to be pulled from TestDateLog.
Thanks for looking at it.
...rule')
INSERT INTO TestDateLog(DateItem,EmpID,Note)VALUES('12/12/2006',3,'i like elephants')
SELECT *
FROM TestEmp E LEFT OUTER JOIN
(SELECT DL.DateItem,DL.ID,DL.EmpId,DL.Note
FROM TestDateLog DL INNER JOIN
(SELECT MIN(DateItem) AS DateItem, EmpID...
FYI: we dont have daylight savings where I live ...
along the daylight saving thing what happens in the time that that occurs.
Say that 2Am (or whenever daylight saving starts) you make some records
4-1-2004 2.00.01 am
4-1-2004 2.01.01 am
4-1-2004 2.02.01 am
4-1-2004 2.03.01 am
then at...
...Set @StartTime = GetDate()
DECLARE @maxpoint int
SELECT @maxpoint = MAX(PointNumber) FROM MapPoints
Set @EndTime = GetDate()
SELECT COUNT(*) AS Total FROM (
SELECT LocationId FROM
MapCountiesPoints MP1 INNER JOIN MapCountiesPoints MP2 ON MP1.PointNumber = (MP2.PointNumber +...
My eratosthenes took about 10 secs longer than that
replacing the Join part with
DECLARE @i int
SET @i = 2
WHILE @i < SQRT(@NumRows)
BEGIN
DELETE FROM #t WHERE RowNum%@i=0 AND RowNum > @i
SET @i = (SELECT MIN(RowNum) FROM #t where RowNum>@i)
END
...This is because of the following
in the list 1,2,3,4,5,6 if you delete the multiples of 2 then you have
1,2,3,5
So if we are looking at 1-10000
100*100 = 10000
So we have to check from 1-100
this is because any Numbers that are not prime above the SQRT will be in the form a*b where a>100 and...
On a Sybase app I was creating a package that pulled some random numbers. so i did something like
SELECT Rand(Column * (datepart(ms,getdate()))
Well on sybase the seed you pass in there is a global seed. There was a row with a zero causing the rand(0) = 0.
Since Sybase sets the seed to a...
Changing the +6 to +5 then maving the +1 to the outside seems to do it
declare @WhichDay tinyint -- US English datefirst assumed (1 - Sunday)
declare @StartDate datetime
set @StartDate = '20060111'
set @WhichDay = 4-- next wed 1-18
//1-18
SET DATEFIRST 7
SELECT...
declare @WhichDay tinyint -- US English datefirst assumed (1 - Sunday)
declare @StartDate datetime
set @StartDate = '20060111'
set @WhichDay = 1-- next Sunday, result should be Jan 15th
//returns 1-16
SET DATEFIRST 7
SELECT (6 + (@WhichDay + DATEPART(dw, @StartDate))) % 7 + @StartDate +...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.