The following are the custom functions of Infor syteline 8.02:
Copy codeThe Code is as follows:
MidnightOf
Alter function [dbo]. [MidnightOf] (
@ Date DATETIME
) RETURNS DATETIME
AS
BEGIN
RETURN (dateadd (year, (datepart (year, @ Date)-2000), dateadd (month, (datepart (month, @ Date)-1), dateadd (day, (datepart (day, @ Date)-1), '20140901 '))))
END
Below is the book
Method provided on page 1:
Copy codeThe Code is as follows:
Select dateadd (day, DATEDIFF (day, '20140901', CURRENT_TIMESTAMP), '20140901 ');
The following is the Insus. NET method. This method can only be applied on SQL Server 2008 or later versions, because only the DATE and TIME data types are available in this version.
Version 1:
Copy codeThe Code is as follows:
Select cast (CURRENT_TIMESTAMP as date) as char (10) + ''+ '00: 00: 00.000 ') as datetime)
Version 2:
Copy codeThe Code is as follows:
Select cast (CURRENT_TIMESTAMP as date) as datetime)