æ°ããæ¥ä»ãã¼ã¿åï¼dateï¼timeï¼datetime2ï¼datetimeoffsetï¼
SQL Server 2008 ããã¯ãæ°ããæ¥ä»ãã¼ã¿åã¨ãã¦ãdateï¼timeï¼datetime2ï¼datetimeoffset ã® 4ã¤ã追å ããã¾ãããããããã®åä½ï¼ç²¾åº¦ï¼ã¨å
é¨çã«ä½¿ç¨ãããã¤ãæ°ããå¾æ¥ã®ãã¼ã¿åï¼datetime / smalldatetimeï¼ã¨æ¯è¼ããã¨ã次ã®è¡¨ã®ããã«ãªãã¾ãã
date ãã¼ã¿åã¯ããæ¥ãåä½ã§ãã¼ã¿ãæ ¼ç´ã§ãããã¼ã¿åã§ã使ç¨ãã¤ãæ°ã 3ãã¤ãã«æãããã¨ãã§ããã®ã§ãæéãæ ¼ç´ããå¿
è¦ã®ãªããã¼ã¿ã®å ´åã«ã¯ã大å¤ä¾¿å©ãªãã¼ã¿åã§ãã
time ãã¼ã¿åã¯ããæéãã®ã¿ãæ ¼ç´ã§ãããã¼ã¿åã§ãå¾æ¥ã® datetime ãã¼ã¿åããã精度ãé«ãæéï¼100ããç§ï¼ã¾ã§æ ¼ç´ã§ããã®ãç¹å¾´ã§ãã
datetime2 ãã¼ã¿åã¯ãtime ãã¼ã¿åã¨åæ§ãæéã 100ããç§ã¾ã§æ ¼ç´ã§ãããã¤å¾æ¥ã® datetime ãã¼ã¿åã®ããã«æ¥ä»ãæ ¼ç´ã§ããã®ãç¹å¾´ã§ãã
datetimeoffset ãã¼ã¿åã¯ãdatetime2 ãã¼ã¿åã®æ ¼ç´ç¯å²ã«å ãã¦ãã¿ã¤ã ã¾ã¼ã³ã®ãªãã»ããï¼UTCï¼åå®ä¸çæããã®æéå·®ï¼ãæ ¼ç´ã§ããããã«ãªã£ããã¼ã¿åã§ãã
ãããã®ãã¼ã¿åã¯ã次ã®ããã«è©¦ããã¨ãã§ãã¾ãã
SELECT CAST('2007-12-13 12:35:29.123' AS datetime) AS 'datetime' ,CAST('2007-12-13 12:35:29.123' AS smalldatetime) AS 'smalldatetime' ,CAST('2007-12-13 12:35:29.1234567 +12:15' AS date) AS 'date' ,CAST('2007-12-13 12:35:29.1234567 +12:15' AS time(7)) AS 'time' ,CAST('2007-12-13 12:35:29.1234567 +12:15' AS datetime2) AS 'datetime2' ,CAST('2007-12-13 12:35:29.1234567 +12:15' AS datetimeoffset(7)) AS 'datetimeoffset'
ãã®ã»ãã® SQL Server 2008 ã®æ°æ©è½ã®å
·ä½çãªå©ç¨æ¹æ³ã«ã¤ãã¦ã¯ãå¼ç¤¾å·çã® SQL Server 2008 èªç¿æ¸ã·ãªã¼ãºï¼ä¸è¨ URLï¼ã®ãSQL Server 2008 ã®æ³¨ç®ã®æ°æ©è½ãã¤ãæ©ã試ãã¦ã¿ãã! ãç·¨ãåèã«ãã¦ã¿ã¦ãã ããã
http://www.microsoft.com/japan/sqlserver/2008/self-learning/default.mspx