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

將 SQL Server DateTime 列遷移到 DateTimeOffset

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

問題描述

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

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

這有效,但是當我執行 datetimedatetimeoffset 分配時,偏移量設置為 0.幸運的是,我想設置的偏移量是當前系統的偏移量.我似乎想不出一個簡單的方法來做到這一點.

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.

我希望能夠在轉換中設置偏移量.我打算使用 C# 實用程序(或 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 類型,則此語法將用于獲取服務器的本地 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())

結果在 MINUTES 內.

The result is in MINUTES.

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

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

相關文檔推薦

SQL trigger on Truncate(截斷時的 SQL 觸發器)
sql search query with multiple optional search parameters(具有多個可選搜索參數的 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 中刪除行)
主站蜘蛛池模板: 成人av播放| 国产在线观看不卡一区二区三区 | 超碰免费在线 | 91精品国产91久久综合桃花 | 一区二区免费 | 日韩免费视频一区二区 | 麻豆久久久久 | 亚洲视频一区在线播放 | 亚洲精品免费观看 | 亚洲精品日韩在线 | 久久伦理电影 | 亚洲自拍偷拍av | 国产日屁 | 欧美国产激情 | 成人黄色电影免费 | 九九av | 狠狠躁夜夜躁人人爽天天高潮 | 一区二区三区精品 | www.99热| 成人一区在线观看 | 国产最好的av国产大片 | 极品销魂美女一区二区 | 日韩小视频 | 你懂的国产 | 先锋影音资源网站 | 精品三级在线观看 | 一级做a毛片 | 涩涩视频在线观看 | 欧美一区精品 | 九九99精品| 久久99国产精品久久99果冻传媒 | 99久久99| 国产目拍亚洲精品99久久精品 | 国产日韩欧美在线观看 | 九九久久国产 | 国产欧美日韩一区 | 午夜欧美一区二区三区在线播放 | 亚洲视频一区二区 | 久久大全 | 91精品国产色综合久久 | 成人午夜视频在线观看 |