我想使用SQL查询将'29 / 05/2014'转换为2014年5月29日的形式 [英] i want to convert '29/05/2014' to the form of 29-may-2014 using SQL query

查看:64
本文介绍了我想使用SQL查询将'29 / 05/2014'转换为2014年5月29日的形式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用过



  convert  varchar  10 ),'  29/05/2014' 106 





但它不起作用

解决方案

是的,它不会,表达式应该在 datetime 要转换的格式。

它会起作用,因为 getdate()日期时间



 选择 转换 varchar  14 ),Getdate(), 106 





所以,请转换你的日期格式化为日期时间格式化,然后继续。

 选择 转换 varchar  14 ), convert  datetime '  29/05/2014' 103 ), 106 


I'm used

convert(varchar(10),'29/05/2014' ,106)



but it's not working

解决方案

Yeah, it will not , the expression should be in datetime format to convert.
it will work,because getdate() is Datetime.

select convert(varchar(14),Getdate() ,106)



So, please convert your Date format into Datetime Format before you proceed.

select convert(varchar(14),convert(datetime,'29/05/2014',103) ,106)


这篇关于我想使用SQL查询将'29 / 05/2014'转换为2014年5月29日的形式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆