LoginSignup
0
0

More than 5 years have passed since last update.

SQLserverでdatetimeの項目を「yyyy年mm月dd日」の形式で表示する

Last updated at Posted at 2017-05-09

概要

SQLserverでdatetimeの項目を「yyyy年mm月dd日」の形式で表示する方法です。

function等を使えば精緻な処理が可能だが、 FORMAT 関数が利用できないバージョンを使用している人、権限の問題がある人、大げさな処理を入れたくない人用

記述方法

*「yyyy年mm月dd日」形式
left(STUFF(STUFF(STUFF(convert(varchar,GETDATE(),120),11,0 ,'日'),8,1,'月'),5,1,'年'),11)

0
0
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0