SQL Server相当于Oracle'to_char' [英] SQL Server equivalent to Oracle 'to_char'

查看:333
本文介绍了SQL Server相当于Oracle'to_char'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

to_char(DATE_TILL,''dd-MON-rrrr'')这是Oracle语法,只能从表中获取日期。

什么是SQL Server的替代?

请尽快回复

to_char(DATE_TILL,''dd-MON-rrrr'') this is Oracle syntax to get only date from table.
What is alternate in SQL Server?
Please reply soon

推荐答案

内置转换函数仅支持有限数量的格式化,但您可以编写自己的函数来扩展它。

http://www.sql-server-helper。 com / tips / date-formats.aspx [ ^ ]

http://anubhavg.wordpress.com/2009/06/11/how-to-format-datetime-date-in-sql-server-2005/ [ ^ ]

http://dataeducation.com/blog/output-date-formatting [ ^ ]



在SQL 2012中,你有一个 FORMAT [ ^ ]开箱即用的功能可以做得更多。
The built-in convert function supports only limited number of formatting, but you can write your own function to extend it.
http://www.sql-server-helper.com/tips/date-formats.aspx[^]
http://anubhavg.wordpress.com/2009/06/11/how-to-format-datetime-date-in-sql-server-2005/[^]
http://dataeducation.com/blog/output-date-formatting[^]

In SQL 2012 you have a FORMAT[^] function out of the box capable of doing much more.


这篇关于SQL Server相当于Oracle'to_char'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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