Wednesday, March 7, 2012

function for absolute day value

In other words, from whenever the calendar begins, a serial number
representing the day.
if 1/1/1904 is 1, then 1/1/1905 is 366, and so on.
is there a function in tsql to get this number from a datetime field value?billdebug wrote:
> In other words, from whenever the calendar begins, a serial number
> representing the day.
> if 1/1/1904 is 1, then 1/1/1905 is 366, and so on.
> is there a function in tsql to get this number from a datetime field value?[/color
]
SELECT DATETDIFF(DAY, /* your base date */, /* some other date */);
David Portas, SQL Server MVP
Whenever possible please post enough code to reproduce your problem.
Including CREATE TABLE and INSERT statements usually helps.
State what version of SQL Server you are using and specify the content
of any error messages.
SQL Server Books Online:
http://msdn2.microsoft.com/library/ms130214(en-US,SQL.90).aspx
--

No comments:

Post a Comment