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

將 SQL Server DateTime 列遷移到 DateTimeOffset

Migrate SQL Server DateTime column to DateTimeOffset(將 SQL Server DateTime 列遷移到 DateTimeOffset)
本文介紹了將 SQL Server DateTime 列遷移到 DateTimeOffset的處理方法,對大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

問題描述

我有一個(gè)舊表,其中幾行有一個(gè)日期時(shí)間列.我想將其切換到 datetimeoffset 但我希望能夠傳輸已經(jīng)存在的數(shù)據(jù).所以我正在做類似的事情:

I have an old table with a few rows that has a datetime column. I want to switch this to datetimeoffset but I want to be able to transfer the data that already exists. So I'm doing something like:

SET IDENTITY_INSERT Table_Temp ON

INSERT INTO Table_Temp
    (Col0, ... ColN,)
SELECT 
    COl0,.... ColN, from 
Table_Original;
    
SET IDENTITY_INSERT Table_Temp OFF

這有效,但是當(dāng)我執(zhí)行 datetimedatetimeoffset 分配時(shí),偏移量設(shè)置為 0.幸運(yùn)的是,我想設(shè)置的偏移量是當(dāng)前系統(tǒng)的偏移量.我似乎想不出一個(gè)簡單的方法來做到這一點(diǎn).

This works but the offset set is 0 when I do the datetime to datetimeoffset assignment. Fortunately the offset that I want to set it to is the offset of the current system. I can't seem to figure out an easy way to do this.

我希望能夠在轉(zhuǎn)換中設(shè)置偏移量.我打算使用 C# 實(shí)用程序(或 PowerShell),但我寧愿保持簡單.

I want to be able to set the offset within the conversion. I was going to resort to doing a C# utility(or PowerShell) but I would rather keep it simple.

推薦答案

如果您使用的 SQL Server 版本知道 datetimeoffset 類型,則此語法將用于獲取服務(wù)器的本地 tz 偏移量:

If you're using a version of SQL Server that knows of the datetimeoffset type, this syntax will work for getting you the local tz offset of the server:

選擇日期部分(tz,sysdatetimeoffset())

結(jié)果在 MINUTES 內(nèi).

The result is in MINUTES.

這篇關(guān)于將 SQL Server DateTime 列遷移到 DateTimeOffset的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

相關(guān)文檔推薦

SQL trigger on Truncate(截?cái)鄷r(shí)的 SQL 觸發(fā)器)
sql search query with multiple optional search parameters(具有多個(gè)可選搜索參數(shù)的 sql 搜索查詢)
SQL Efficiency: WHERE IN Subquery vs. JOIN then GROUP(SQL 效率:WHERE IN 子查詢 vs. JOIN 然后 GROUP)
Retrieving XML element name using t-SQL(使用 t-SQL 檢索 XML 元素名稱)
Insert double quotes into SQL output(在 SQL 輸出中插入雙引號)
Delete rows from CTE in SQL SERVER(從 SQL SERVER 中的 CTE 中刪除行)
主站蜘蛛池模板: 欧美黄色免费网站 | 在线国产小视频 | 美女毛片视频 | 久久一区二区视频 | 日韩精品欧美 | 久草免费福利视频 | 久久久精品一区二区三区 | 亚洲色欲色欲www在线观看 | 中文字幕一区二区在线播放 | 国产1级片 | 成人精品在线 | 日韩国产一区 | 亚洲国产精品av | 免费欧美视频 | 国产黄色一区 | 亚洲视频一区二区三区 | 欧美日韩高清在线 | 久操伊人 | 日韩精品视频免费播放 | 一级黄色免费看 | 亚洲一区在线播放 | 男人添女人囗交图 | 狠狠做 | 中文字幕系列 | 三级黄色在线观看 | 久久久久久久影院 | 免费播放av | 国产欧美精品一区二区三区 | 四虎在线免费观看视频 | 欧美vieox另类极品 | 免费a视频| 久久性生活视频 | 狠狠操狠狠爱 | 黄色片免费在线观看 | 中文在线观看视频 | 97在线播放 | 欧美日韩在线播放 | 中文字幕亚洲一区 | 免费网站观看www在线观 | 一级黄色免费看 | 精品欧美一区二区精品久久 |