Created
June 8, 2016 14:40
-
-
Save strvmarv/4fa868f31d354d191f3f29bd485d6cff to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE FUNCTION [dbo].[udf_GetDayOfTheYear] (@input DATETIME = NULL) | |
RETURNS SMALLINT AS | |
BEGIN | |
DECLARE @doty SMALLINT | |
IF (@input IS NULL) | |
BEGIN | |
SELECT @doty = DATEPART(dy, GETUTCDATE()) | |
END | |
ELSE | |
BEGIN | |
SELECT @doty = DATEPART(dy, @input) | |
END | |
RETURN @doty | |
END |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment