SQL Server 中讀取當前年月

taogchan發表於2013-12-12
  SQL Server 中讀取當前年月
1、讀取當前年月:select convert(char(7),getdate(),112);
2、讀取資料庫中列的年月: select convert(char(7),[Date]{此為列名},20)
3、讀取當前月份的前兩個月份:
      select convert(char(7),DateAdd ("m" , -2 , getdate()),20)

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/22392018/viewspace-1063102/,如需轉載,請註明出處,否則將追究法律責任。

相關文章