久久久久久久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 | 精品无码久久久久久久动漫 | 黑人巨大精品欧美一区二区免费 | 欧美一级黑人aaaaaaa做受 | 成人在线电影网站 | 欧美视频 亚洲视频 | 久久久一区二区三区 | 欧美一区二区在线看 | 久久高清| 天天综合久久 | 精品亚洲一区二区 | 久久亚洲精品久久国产一区二区 | 亚洲视频二区 | 国产成人精品一区 | 久干网 | 久久一本 | 日本天堂一区 | 丁香婷婷久久久综合精品国产 | 欧美日韩久 | 国产精品亚洲成在人线 | 日韩免费福利视频 | 亚洲精品丝袜日韩 | 成人在线播放网址 | 亚洲日韩视频 | 国产伦一区二区三区久久 | 人人人人爽 | 黄色av免费 | 精品欧美二区 | 午夜网| 欧美日韩一二三区 | 国产一区二区三区四区在线观看 | 日韩中文一区 | 在线观看免费观看在线91 |