将年份转换为年份SQL的文本拼写 [英] Convert year to text spelling of year SQL

查看:120
本文介绍了将年份转换为年份SQL的文本拼写的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的老板要我在我们的SQL日期维度中添加一列,将我们的year_number(EX。1996,1997等)转换成文本拼写(EX。Nineteen Ninety Six)。我一直在寻找东西,但无法想出这个。



谢谢!



我的尝试:



我尝试了DATENAME,但它返回了数字。

My boss wants me to add a column to our SQL date dimension which converts our year_number (EX. "1996","1997" etc.) to the text spelling (EX. "Nineteen Ninety Six"). I have been looking stuff up but can't figure this one out.

Thank you!

What I have tried:

I tried DATENAME but it returns numbers.

推荐答案

检查:sql - 转换任何数字 - Stack Overflow [ ^ ]


引用:

我一直在寻找东西,但无法想出这个。

I have been looking stuff up but can't figure this one out.



我想你有一些年的时间来管理并且你需要多次转换。

SQL擅长管理表,为什么不创建一个包含2个字段的表?

第一个字段是数字年份,主键。

第二个字段是按照你想要的方式拼写的文字。

手动填写表格。

获得转换是一种简单的查找。


I guess you have a little number of years to manage and you will need the convertion many times.
SQL is good at managing tables, why not create a table with 2 fields?
First field is numeric year, primary key.
Second field is the text spelling the year the way you want.
Fill the table manually.
Getting a conversion is a simple lookup.


这篇关于将年份转换为年份SQL的文本拼写的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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