Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
SELECT GETDATE();
GO
/** Output **/
-----------------------
2017-03-20 16:57:22.273
SELECT DATEPART(yy, ord.OrderDate)
FROM [ORDER] ord;
GO
/** Output **/
2014
2014
2014
2014
2014
2014
2014
...
SELECT DATEADD(mm, 1, GETDATE());
GO
/** Output **/
-----------------------
2017-04-20 16:59:18.760
SELECT MONTH('20170426');
GO
/** Output **/
-----------
4
SELECT DAY('20170426');
GO
/** Output **/
-----------
26
SELECT YEAR('20170426');
GO
/** Output **/
-----------
2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.