English 中文(简体)
ql服务器转换日期,以显示MM/DD/YYYY
原标题:sql server convert date to string MM/DD/YYYY

我正在使用2008年的服务器。

我有:

    select convert(varchar(20),fmdate) from Sery

我如何将日期改为显示其为MM/DD/YYYYY。

最佳回答

这项任务应该由您的软件包的下层完成。 它是一个数据存放处,而不是一个列报系统。

You can do it with

CONVERT(VARCHAR(10), fmdate(), 101)

但是,你们应该这样做。

问题回答
select convert(varchar(10), fmdate, 101) from sery

101 是一个风格的论点。

这里可以找到休息。

CAST和CONVERT (Transact-SQL) - 日期和时间风格

select convert(varchar(10), cast(fmdate as date), 101) from sery

如果我没有投票,我就没有改写,那么时间就是说。





相关问题
SQL Server 2008 R2 RTM on MSDN?

SQL Server 2008 R2 has supposedly been Released to Manufacturing. Does anyone know when it s supposed to show up on MSDN?

What is new for developers in SQL Server 2008 R2

Today was released SQL Server 2008 R2. Was trying to find what is new (from the developer perspective), but the MS sites has all the PR blah, blah, blah. There is something new to be aware?

Missing: Utility Explorer in Management Studio 2008 R2

I am trying to use Data-Tier applications and am going through the tutorial here. When I get to step two the tutorial says to open Utility Explorer in the view menu. But it is not there! I looked all ...

What does PI in OSIsoft s PI System stand for?

What does PI in OSIsoft s PI System stand for? I can t tell if it stands for the symbol/number Pi, or if it stands for a previous name for the technology, like Process Intelligence . PI is too ...

How do I find the data directory for a SQL Server instance?

We have a few huge databases (20GB+) which mostly contain static lookup data. Because our application executes joins against tables in these databases, they have to be part of each developers local ...