久久久久久久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?

推薦答案

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

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.

如果您以多種方式存儲天數(可能在基于字符的系統(tǒng)中),您可以將所有變體放入表中,因此 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 數據類型來存儲字節(jié) [])
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?什么時候不能投射為日期?)
主站蜘蛛池模板: 欧美aaaaaaaa| 欧美亚洲视频在线观看 | 日韩欧美国产成人一区二区 | 在线免费观看成人 | 免费av电影网站 | 播放一级黄色片 | 涩涩导航 | 一区视频 | 欧美激情一区二区三区 | 国产精品一区二区三区久久久 | 一区二区三区四区不卡视频 | 国产激情一区二区三区 | av激情在线| 韩日精品在线观看 | 黄色大片网站 | 精品毛片| 日本高清aⅴ毛片免费 | 免费激情网站 | 成年人黄色一级毛片 | 亚洲精品国产成人 | 在线视频国产一区 | 毛片区| 日韩在线视频一区 | 在线观看 亚洲 | 成人永久免费视频 | 亚洲精品在线免费播放 | 欧美亚洲视频在线观看 | 精品久久久一区二区 | 中文字幕精品一区 | 日韩av在线一区二区 | 日韩欧美一区在线 | 99热在线免费| 久久精品免费一区二区三 | www成年人视频 | av在线免费网 | h小视频 | 亚洲国产精品一区二区第一页 | www.夜夜骑.com | 免费午夜视频 | 在线观看亚洲专区 | 黄色成人在线 |