次の方法で共有


Date and Time with SQL Server...

Understanding date/time data types in SQL Server can be difficult, especially when you add TIMESTAMP into the mix. In part one of this series on date/time, you'll learn the basics of how data is stored within DATETIME and SMALLDATETIME and get an overview of the TIMESTAMP data type -- as it's often confused with the two primary date/time data types.

...

In this article, I explain how to convert DATETIME and SMALLDATETIME data types to character data and how character data can be converted to date/time data. Specifically, the article describes how Transact-SQL supports two built-in functions for converting data in SQL Server -- implicit conversion and explicit conversion. In a previous tip, Basics for working with DATETIME and SMALLDATETIME in SQL Server 2005 , I described how SQL Server uses the DATETIME and SMALLDATETIME data types to store date/time data. In this article, I'll explain how it can be converted to character data and how character data can be converted to date/time data and how Transact-SQL supports two methods for performing these data conversions -- implicit conversion and explicit conversion.

...

image

 

But with SQL Server 2008 we have now more options regarding date et time types :

SQL Server 2008 introduces four new date and time data types. These types enable applications to have separate types for date or time, increased year range, increased fractional second precision and time-zone offset support. For more information, see Using Date and Time Data .

image