sql 2000時間格式

2021-06-03 02:50:52 字數 2100 閱讀 2835

sql server中日期時間只取年月日  2010-01-28 17:25:08|  分類: sql |  標籤: |字型大小大

中小 訂閱

sql server中日期時間只取年月日

2023年05月05日 星期二 下午 05:27

select convert(varchar, getdate(), 120 )

2004-09-12 11:06:08

select replace(replace(replace(convert(varchar, getdate(), 120 ),'-',''),' ',''),':','')

20040912110608

select convert(varchar(12) , getdate(), 111 )

2004/09/12

select convert(varchar(12) , getdate(), 112 )

20040912

select convert(varchar(12) , getdate(), 102 )

2004.09.12

select convert(varchar(12) , getdate(), 101 )

09/12/2004

select convert(varchar(12) , getdate(), 103 )

12/09/2004

select convert(varchar(12) , getdate(), 104 )

12.09.2004

select convert(varchar(12) , getdate(), 105 )

12-09-2004

select convert(varchar(12) , getdate(), 106 )

12 09 2004

select convert(varchar(12) , getdate(), 107 )

09 12, 2004

select convert(varchar(12) , getdate(), 108 )

11:06:08

select convert(varchar(12) , getdate(), 109 )

09 12 2004 1

select convert(varchar(12) , getdate(), 110 )

09-12-2004

select convert(varchar(12) , getdate(), 113 )

12 09 2004 1

select convert(varchar(12) , getdate(), 114 )

11:06:08.177

getdate( ) 返回系統目前的日期與時間

datediff (interval,date1,date2) 以interval 指定的方式,返回date2 與date1兩個日期之間的差值 date2-date1

dateadd (interval,number,date) 以interval指定的方式,加上number之後的日期

datepart (interval,date) 返回日期date中,interval指定部分所對應的整數值

datename (interval,date) 返回日期date中,interval指定部分所對應的字串名稱

引數 interval的設定值如下:

值 縮 寫(sql server) (access 和 asp) 說明

year yy yyyy 年 1753 ~ 9999

quarter qq q   季 1 ~ 4

month mm m   月1 ~ 12

day of year dy y 一年的日數,一年中的第幾日 1-366

day dd d   日,1-31

weekday dw w 一周的日數,一周中的第幾日 1-7

week wk ww 周,一年中的第幾周 0 ~ 51

hour hh h   時0 ~ 23

minute mi n 分鐘0 ~ 59

second ss s 秒 0 ~ 59

millisecond ms - 毫秒 0 ~ 999

sql2000儲存過程

自 http www.cnblogs.com a13971240 archive 2008 10 22 1316747.html create proc getdataset tablelist varchar 200 搜尋表的字段,比如 id,datatime,job 用逗號隔開 tablenam...

SQL 2000如何分頁

網上搜的sql 2000如何分頁,程式中採用的是方案二的方法,如下 應乙個朋友的要求,貼上收藏的sql常用分頁的辦法 表中主鍵必須為標識列,id int identity 1,1 1.分頁方案一 利用not in和select top分頁 語句形式 select top 頁記錄數量 from 表名 ...

sql 2000 基本框架

我們現在學習的sql 2000 資料庫管理系統.其實我們在平時說的時候,總是喜歡簡化的說,但是在理解的時候如果你還簡化的理解.那麼就理解不了.比如說是我們再學習資料庫.難道是我們再學習那個資料的庫嗎?當然不是.其實我們說的資料庫分為.資料庫,資料庫管理系統,使用者三部分組成.資料庫就是其中資料庫,就...