The DATE data type in SQL Server 2008 (and later)

One of the new data types originally shipped with SQL Server 2008 is the “DATE” data type.

The DATE data type provides only the date without requiring from the database developers to extract the date from the datetime anymore.

To this end you can just get the date with a single line of code:

SELECT CAST (SYSDATETIME() as DATE) as [current_date];
GO

or

SELECT CAST(GETDATE() as DATE) as [current_date];
GO

 

Read Also:

 

Featured Database Productivity Tools

Snippets Generator: Create and modify T-SQL snippets for use in SQL Management Studio, fast, easy and efficiently.

Snippets Generator - SQL Snippets Creation Tool

Learn more

 

Dynamic SQL Generator: Convert static T-SQL code to dynamic and vice versa, easily and fast.

Dynamic SQL Generator: Easily convert static SQL Server T-SQL scripts to dynamic and vice versa.

Learn more

 

Subscribe to our newsletter and stay up to date!

Check out our latest software releases!

Check out Artemakis’s eBooks!

 

Rate this article: 1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 5.00 out of 5)

Loading...

Reference: SQLNetHub.com (https://www.sqlnethub.com)

© SQLNetHub