我如何从查询中获取本地化的日期名称 [英] how I can get localized day name from query

查看:78
本文介绍了我如何从查询中获取本地化的日期名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有查询获取日期名称

I have a query to get day name

select format(CONVERT (date, '14/01/2015', 103), 'dddd') from employees





但它给了我英文的名字我怎么能强迫它给我一天的名字总是在阿拉伯语



but it gives me the day name in english How I can force it to give me the day name always in arabic

推荐答案

你不想,即使你可以。

这种细节是演示功能,而不是数据库 - 应该在演示软件中处理,它可以告诉用户的区域设置和文化设置。 SQL不知道这些事情 - 你很幸运它可以分开一周的日子! :笑:



说真的,这不是数据库的用途:它们处理原始数据而不是用户就绪数据并试图强迫它们做别的事就是在惹麻烦。想一想:在三层模型中,关于用户偏好的数据必须从PL传输,通过BL传输到DL - 然后发送到SQL,然后再传回。将所有这些保留在它所属的PL中更为整洁,就像你将本地日期格式转换为内部DateTime,或者在离开PL之前的ISO格式一样。
You don't want to, even if you could.
That kind of detail is a presentation function, not a database - and should be handled in your presentation software, which can tell what the users Locale and Culture are set to. SQL doesn't know about such things - you're lucky it can separate out the day of the week at all! :laugh:

Seriously, that is not what a database is there for: they deal in "raw data" not "user ready data" and trying to force them to do something else is asking for trouble. Think of it: in the three layer model, the data as to the user preference has to be transported from the PL, via the BL, to the DL - then sent to SQL, and transferred back again. Much tidier to keep all that in the PL where it belongs, in the same way that you would "translate" a local date format into an internal DateTime, or an ISO format before it leaves the PL.


这篇关于我如何从查询中获取本地化的日期名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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