久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

將一天的名稱轉換為其整數表示

Converting the name of a day to its integer representation(將一天的名稱轉換為其整數表示)
本文介紹了將一天的名稱轉換為其整數表示的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

限時送ChatGPT賬號..

在 SQL Server 中,您可以使用 DATENAME 函數以字符串形式獲取星期幾

In SQL server you can use the DATENAME function to get the day of week as a string

declare @date datetime
set @date = '12/16/08'
select datename(dw, @date)

返回星期二"

并且您可以使用 DATEPART 函數以整數形式獲取星期幾

and you can use the DATEPART function to get the day of week as an integer

declare @date datetime
set @date = '12/16/08'
select datepart(dw, @date)

返回 3

但是假設我有一個包含字符串Tuesday"的 varchar,我想將它轉換為 3 的整數表示.當然,我可以毫不費力地寫出轉換,但我更愿意使用內置的- 在功能.有這樣的功能嗎?

But say I have a varchar that contains the string "Tuesday" and I want to convert it to its integer representation of 3. Sure, I could write out the conversion without much hassle, but I'd much rather use a built-in function. Does such a function exist?

推薦答案

與其編寫函數,不如創建一個包含說明和數值的星期幾表.然后您可以簡單地加入表格以獲取數字.

Rather than write a function, you should create a days of the week table with the description and the numeric value. THen you can simply join to the table to get the numeric.

如果您以多種方式存儲天數(可能在基于字符的系統中),您可以將所有變體放入表中,因此 TUE、Tues.、Tuesday 都將映射到相同的整數.

And if you have days stored multiple ways (likely in a characterbased system), you can put all the variants into the table, so TUE, Tues., Tuesday would all map to the same integer.

這篇關于將一天的名稱轉換為其整數表示的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

What SQL Server Datatype Should I Use To Store A Byte[](我應該使用什么 SQL Server 數據類型來存儲字節 [])
Interpreting type codes in sys.objects in SQL Server(解釋 SQL Server 中 sys.objects 中的類型代碼)
Typeorm Does not return all data(Typeorm 不返回所有數據)
Typeorm .loadRelationCountAndMap returns zeros(Typeorm .loadRelationCountAndMap 返回零)
How to convert #39;2016-07-01 01:12:22 PM#39; to #39;2016-07-01 13:12:22#39; hour format?(如何將“2016-07-01 01:12:22 PM轉換為“2016-07-01 13:12:22小時格式?)
MS SQL: Should ISDATE() Return quot;1quot; when Cannot Cast as Date?(MS SQL:ISDATE() 是否應該返回“1?什么時候不能投射為日期?)
主站蜘蛛池模板: 国产蜜臀av | 顶级黄色片 | 在线免费观看黄色片 | 日韩高清不卡 | 最近日本中文字幕 | 亚洲精品免费在线 | 色婷婷国产| 日韩精品在线一区二区 | av毛片网站 | 神马午夜影院 | 久久久久久久久国产精品 | 欧美一级免费看 | 欧美国产一区二区 | 久久精品2| 中文字幕在线观看网站 | 日韩免费高清视频 | 精品一区二区三区在线观看 | 野外(巨肉高h) | 久久精品视频网站 | 国产精品福利在线 | 久久久久久艹 | 五月天在线观看 | 最新国产精品 | 国产欧美日韩综合精品 | 亚洲男人在线 | 少妇xxxx69| 一区二区在线 | 97视频免费| 国产激情久久 | 操bbbbb | 国产精品国产三级国产aⅴ浪潮 | 精品亚洲国产成人av制服丝袜 | 手机av片 | 一本一道久久a久久精品蜜桃 | 激情综合色 | 美女黄色大片 | 日本免费黄色 | 亚洲欧美视频 | 99xav| 亚洲永久精品视频 | 日韩专区中文字幕 |