My string dates are as follows in YearMonth format:
201008
201009
201010
201011
201012
...
The following is my CONVERT
statement in my stored procedure:
CONVERT (datetime, @FileName, 104)
My results are showing up like:
10/7/2020
10/8/2020
10/9/2020
...
How do I get my results to show up as:
07/2010
08/2010
09/2010
...
Its obviously the 104
code in my CONVERT
statement. What code should I use?
Thanks
4条答案
按热度按时间vsnjm48y1#
使用
112
代替104。从docs:112 =年年月日
这似乎与您的格式非常匹配。您唯一需要做的就是添加'01':
bbuxkriu2#
也许你会满意这样的东西:
cyej8jka3#
Run this you will get an entire table of the datetime format constants from T-SQL supported by exec results!
qxsslcnc4#
运行此命令,您将从执行结果支持的T-SQL中获得完整的日期时间格式常量表!