Dofactory.com
Dofactory.com
Earn income with your data and sql skills
Sign up and we'll send you the best freelance opportunities straight to your inbox.
We're building the largest freelancing marketplace for people like you.
By adding your name & email you agree to our terms, privacy and cookie policies.

SQL SMALLDATETIMEFROMPARTS Function

SMALLDATETIMEFROMPARTS creates a smalldatetime value.

The returned value is based on the specified datepart arguments.

All arguments are required. If any is null, then null is returned.

Example

#

This example returns a smalldatetime from the specified dateparts.

SELECT SMALLDATETIMEFROMPARTS(2022, 9, 28, 11, 54) 
       AS SmallDatetime
Result:  1 record
SmallDatetime
2022-09-28 11:54:00

Syntax

Syntax of the SMALLDATETIMEFROMPARTS function .

SMALLDATETIMEFROMPARTS(year, month, day, hour, minute) 

year -- an integer specifying year.

month -- an integer specifying month from 1 to 12.

day -- an integer specifying day of the month.

hour -- an integer specifying the hour.

minute -- an integer specifying the minute.

Note: DATETIMEFROMPARTS will return an error if any of the 5 arguments is invalid. If any of the arguments is null, then the return value will also be null.


You may also like



Last updated on Dec 21, 2023

Earn income with your data and sql skills
Sign up and we'll send you the best freelance opportunities straight to your inbox.
We're building the largest freelancing marketplace for people like you.
By adding your name & email you agree to our terms, privacy and cookie policies.