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

將一天的名稱轉(zhuǎn)換為其整數(shù)表示

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

問題描述

限時送ChatGPT賬號..

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

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 函數(shù)以整數(shù)形式獲取星期幾

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,我想將它轉(zhuǎn)換為 3 的整數(shù)表示.當然,我可以毫不費力地寫出轉(zhuǎn)換,但我更愿意使用內(nèi)置的- 在功能.有這樣的功能嗎?

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?

推薦答案

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

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.

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

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.

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

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

相關文檔推薦

What SQL Server Datatype Should I Use To Store A Byte[](我應該使用什么 SQL Server 數(shù)據(jù)類型來存儲字節(jié) [])
Interpreting type codes in sys.objects in SQL Server(解釋 SQL Server 中 sys.objects 中的類型代碼)
Typeorm Does not return all data(Typeorm 不返回所有數(shù)據(jù))
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轉(zhuǎn)換為“2016-07-01 13:12:22小時格式?)
MS SQL: Should ISDATE() Return quot;1quot; when Cannot Cast as Date?(MS SQL:ISDATE() 是否應該返回“1?什么時候不能投射為日期?)
主站蜘蛛池模板: 午夜播放器在线观看 | 欧美激情一区二区三级高清视频 | 一区二区三区在线观看视频 | 91麻豆精品国产91久久久久久 | 一区二区三区四区av | 国产精品久久久久久影视 | 国产高清毛片 | 男女羞羞免费视频 | 国产精品久久久久久238 | 黄色日本视频 | 91久久精品国产免费一区 | 久久精品亚洲精品国产欧美 | 成人av一区| 91精品国产92 | 日韩一级| 亚洲日本视频 | 成人av网站在线观看 | 精品一区二区三区在线播放 | 欧美日韩精品一区二区三区蜜桃 | av在线免费观看网站 | 99久9| 久久久久成人精品免费播放动漫 | 国产激情91久久精品导航 | 中文字幕乱码一区二区三区 | 欧美激情精品久久久久久变态 | 狠狠操网站 | 国产99久久精品一区二区永久免费 | 免费观看一级特黄欧美大片 | 久久综合九色综合欧美狠狠 | 中文字幕日韩欧美一区二区三区 | 久久久久久久久久久久91 | 台湾佬久久 | 欧美日韩视频在线播放 | 在线91| 久久国产综合 | 国产一区二区在线免费观看 | 精品日本久久久久久久久久 | 精品av| www国产成人免费观看视频,深夜成人网 | 中文字幕亚洲一区二区三区 | 一级一片在线观看 |