当前位置: 代码迷 >> Sql Server >> 关于 convert datetime 日期样式参数的效果解决方案
  详细解决方案

关于 convert datetime 日期样式参数的效果解决方案

热度:82   发布时间:2016-04-27 12:33:35.0
关于 convert datetime 日期样式参数的效果
SQL code
set nocount ondeclare @dt datetimeset @dt = getdate()-- -- 2008-04-14 15:47:49.233-- print 'convert(varchar,@dt, 0) : '+ convert(varchar,@dt,0) print 'convert(varchar,@dt, 1) : '+ convert(varchar,@dt,1)print 'convert(varchar,@dt, 2) : '+ convert(varchar,@dt,2)print 'convert(varchar,@dt, 3) : '+ convert(varchar,@dt,3)print 'convert(varchar,@dt, 4) : '+ convert(varchar,@dt,4)print 'convert(varchar,@dt, 5) : '+ convert(varchar,@dt,5)print 'convert(varchar,@dt, 6) : '+ convert(varchar,@dt,6)print 'convert(varchar,@dt, 7) : '+ convert(varchar,@dt,7)print 'convert(varchar,@dt, 8) : '+ convert(varchar,@dt,8)print 'convert(varchar,@dt, 9) : '+ convert(varchar,@dt,9)print 'convert(varchar,@dt,10) : '+ convert(varchar,@dt,10) print 'convert(varchar,@dt,11) : '+ convert(varchar,@dt,11)print 'convert(varchar,@dt,12) : '+ convert(varchar,@dt,12)print 'convert(varchar,@dt,13) : '+ convert(varchar,@dt,13)print 'convert(varchar,@dt,14) : '+ convert(varchar,@dt,14)print '15 ~ 19 为无效样式号'print 'convert(varchar,@dt,20) : '+ convert(varchar,@dt,20) print 'convert(varchar,@dt,21) : '+ convert(varchar,@dt,21)print 'convert(varchar,@dt,22) : '+ convert(varchar,@dt,22)print 'convert(varchar,@dt,23) : '+ convert(varchar,@dt,23)print 'convert(varchar,@dt,24) : '+ convert(varchar,@dt,24)print 'convert(varchar,@dt,25) : '+ convert(varchar,@dt,25)print '26 ~ 29 为无效样式号'print 'convert(varchar,@dt,100) : '+ convert(varchar,@dt,100) print 'convert(varchar,@dt,101) : '+ convert(varchar,@dt,101)print 'convert(varchar,@dt,102) : '+ convert(varchar,@dt,102)print 'convert(varchar,@dt,103) : '+ convert(varchar,@dt,103)print 'convert(varchar,@dt,104) : '+ convert(varchar,@dt,104)print 'convert(varchar,@dt,105) : '+ convert(varchar,@dt,105)print 'convert(varchar,@dt,106) : '+ convert(varchar,@dt,106)print 'convert(varchar,@dt,107) : '+ convert(varchar,@dt,107)print 'convert(varchar,@dt,108) : '+ convert(varchar,@dt,108)print 'convert(varchar,@dt,109) : '+ convert(varchar,@dt,109)print 'convert(varchar,@dt,110) : '+ convert(varchar,@dt,110) print 'convert(varchar,@dt,111) : '+ convert(varchar,@dt,111)print 'convert(varchar,@dt,112) : '+ convert(varchar,@dt,112)print 'convert(varchar,@dt,113) : '+ convert(varchar,@dt,113)print 'convert(varchar,@dt,114) : '+ convert(varchar,@dt,114)print '115 ~ 119 为无效样式号'print 'convert(varchar,@dt,120) : '+ convert(varchar,@dt,120) print 'convert(varchar,@dt,121) : '+ convert(varchar,@dt,121)print '122 ~ 129 为无效样式号'-- convert(varchar,@dt, 0) : 04 14 2008  3:57PM-- convert(varchar,@dt, 1) : 04/14/08-- convert(varchar,@dt, 2) : 08.04.14-- convert(varchar,@dt, 3) : 14/04/08-- convert(varchar,@dt, 4) : 14.04.08-- convert(varchar,@dt, 5) : 14-04-08-- convert(varchar,@dt, 6) : 14 04 08-- convert(varchar,@dt, 7) : 04 14, 08-- convert(varchar,@dt, 8) : 15:57:16-- convert(varchar,@dt, 9) : 04 14 2008  3:57:16:483PM-- convert(varchar,@dt,10) : 04-14-08-- convert(varchar,@dt,11) : 08/04/14-- convert(varchar,@dt,12) : 080414-- convert(varchar,@dt,13) : 14 04 2008 15:57:16:483-- convert(varchar,@dt,14) : 15:57:16:483-- 15 ~ 19 为无效样式号-- convert(varchar,@dt,20) : 2008-04-14 15:57:16-- convert(varchar,@dt,21) : 2008-04-14 15:57:16.483-- convert(varchar,@dt,22) : 04/14/08  3:57:16 PM-- convert(varchar,@dt,23) : 2008-04-14-- convert(varchar,@dt,24) : 15:57:16-- convert(varchar,@dt,25) : 2008-04-14 15:57:16.483-- 26 ~ 29 为无效样式号-- convert(varchar,@dt,100) : 04 14 2008  3:57PM-- convert(varchar,@dt,101) : 04/14/2008-- convert(varchar,@dt,102) : 2008.04.14-- convert(varchar,@dt,103) : 14/04/2008-- convert(varchar,@dt,104) : 14.04.2008-- convert(varchar,@dt,105) : 14-04-2008-- convert(varchar,@dt,106) : 14 04 2008-- convert(varchar,@dt,107) : 04 14, 2008-- convert(varchar,@dt,108) : 15:57:16-- convert(varchar,@dt,109) : 04 14 2008  3:57:16:483PM-- convert(varchar,@dt,110) : 04-14-2008-- convert(varchar,@dt,111) : 2008/04/14-- convert(varchar,@dt,112) : 20080414-- convert(varchar,@dt,113) : 14 04 2008 15:57:16:483-- convert(varchar,@dt,114) : 15:57:16:483-- 115 ~ 119 为无效样式号-- convert(varchar,@dt,120) : 2008-04-14 15:57:16-- convert(varchar,@dt,121) : 2008-04-14 15:57:16.483-- 122 ~ 129 为无效样式号
  相关解决方案