Paul Pedersen
2004-08-14 23:51:05 UTC
I have a SQL Server table that contains social events that start at a
certain datetime. Is there a clean way to make a view containing the events
that begin on a given day?
In FoxPro, I can just use WHERE TTOD(startdt) = ?whichDate
Is there an equivalent function in SQL Server? If there is, I haven't been
able to find it.
I could add a parameter, to use something like BETWEEN whichDT1 AND
whichDT2, where whichDT2 = DTOT(whichDate + 1), etc. But that would cost me
the goal of avoiding code changes that depend on the back end.
Please don't tell me I have to use DATEPART(year, startdt) = DATEPART(year,
?whichDate) AND DATEPART(month, startdt) = DATEPART(month, ?whichDate) AND
DATEPART(day, startdt) = DATEPART(day, ?whichDate). That would be so
stupid...
certain datetime. Is there a clean way to make a view containing the events
that begin on a given day?
In FoxPro, I can just use WHERE TTOD(startdt) = ?whichDate
Is there an equivalent function in SQL Server? If there is, I haven't been
able to find it.
I could add a parameter, to use something like BETWEEN whichDT1 AND
whichDT2, where whichDT2 = DTOT(whichDate + 1), etc. But that would cost me
the goal of avoiding code changes that depend on the back end.
Please don't tell me I have to use DATEPART(year, startdt) = DATEPART(year,
?whichDate) AND DATEPART(month, startdt) = DATEPART(month, ?whichDate) AND
DATEPART(day, startdt) = DATEPART(day, ?whichDate). That would be so
stupid...