{"id":974,"date":"2025-01-10T00:41:24","date_gmt":"2025-01-10T00:41:24","guid":{"rendered":"https:\/\/turtleflyblog.com\/?p=974"},"modified":"2025-01-10T01:20:52","modified_gmt":"2025-01-10T01:20:52","slug":"sql-server-temporal-table-2","status":"publish","type":"post","link":"https:\/\/turtleflyblog.com\/zh\/2025\/01\/10\/sql-server-temporal-table-2\/","title":{"rendered":"SQL SERVER Temporal Table"},"content":{"rendered":"\n

Temporal Table\u662f\u5728SQL SERVER 2016\u63a8\u51fa\u5f8c\u65b0\u52a0\u7684\u529f\u80fd\uff0cTemporal Table\u4e3b\u8981\u529f\u80fd\u662f\u7d00\u9304Table\u6b77\u53f2\u8cc7\u6599\uff0cTemoral Table\u6703\u8a18\u9304\u6bcf\u4e00\u7b46\u6bcf\u4e00\u6642\u523b\u7570\u52d5\u7684\u8cc7\u6599\u3002\u65b0\u7248\u7684EntityFramework Core\u4e5f\u6709Temporal Table\u7684\u529f\u80fd\u3002Temporal Table\u4e3b\u8981\u6709\u4ee5\u4e0b\u9019\u4e9b\u529f\u80fd<\/p>\n\n\n\n

Auditing<\/strong>: \u5c0d\u65bc\u4e00\u4e9b\u7522\u696d\u5982\u91d1\u878d\u6216\u91ab\u7642\u53ef\u4ee5\u8ffd\u8e64\u6b77\u53f2\u7d00\u9304\uff0c\u770b\u662f\u5426\u6709\u65b0\u589e\u6216\u522a\u9664\u8cc7\u6599\u3002<\/p>\n\n\n\n

History Data Analysis<\/strong>: \u53ef\u4ee5\u5206\u6790\u4e00\u4e9b\u516c\u53f8\u7522\u54c1\u6b77\u53f2\u7d00\u9304\uff0c\u4f86\u5224\u65b7\u7522\u54c1\u92b7\u552e\u7d00\u9304(\u5c24\u5176\u5728\u54ea\u4e00\u6642\u6bb5)\u3002\u5728\u5206\u6790\u80a1\u7968\u884c\u60c5\u4e5f\u6709\u7528\u3002<\/p>\n\n\n\n

Data recovery<\/strong>: \u4f8b\u5982\u9280\u884c\u6709\u4e9b\u696d\u52d9\u7570\u5e38\u6216\u7279\u6b8a\u5f62\u6cc1\u4e0b\uff0c\u53ef\u8ffd\u8e64\u6b77\u53f2\u8cc7\u6599\u4f86\u5fa9\u539f\u8cc7\u6599\u932f\u8aa4\u3002<\/p>\n\n\n\n

\u7bc4\u4f8b:<\/strong><\/p>\n\n\n\n

\u5efa\u7acb\u8cc7\u6599\u8868<\/strong><\/p>\n\n\n\n

\u5148\u65b0\u5efatable\u548c\u5b83\u7684temporal table\u3002Table schema\u5982\u4e0b\u3002\u8868\u540d\u7a31\u70baBookInventory\uff0c\u800c\u6b64table\u7684temporal table\u70badbo.BookInventoryHistory\uff0cBookInventoryHistory\u662fSystem-Versioned\uff0cSystem-Versioned\u610f\u601d\u662f\u6307SQL SERVER\u6703\u81ea\u52d5\u7522\u751f\u548c\u7dad\u8b77Historical Table\u3002<\/p>\n\n\n\n

\"\"<\/figure>\n\n\n\n

GENERATED ALWAYS AS ROW START:<\/strong> \u8cc7\u6599\u5217\u7684\u8d77\u59cb\u6548\u671f<\/p>\n\n\n\n

GENERATED ALWAYS AS ROW END:<\/strong> \u8cc7\u6599\u5217\u7684\u7d50\u675f\u6548\u671f<\/p>\n\n\n\n

 PERIOD FOR SYSTEM_TIME :<\/strong>\u4ee3\u8868\u6548\u671f\u7684\u8d77\u59cb\u8207\u7d42\u9ede<\/p>\n\n\n\n

SYSTEM_VERSIONING = ON<\/strong> (HISTORY_TABLE = dbo.BookInventoryHistory<\/strong>): \u555f\u7528 Temporal Table\u751f\u6548, Temporal Table\u70ba BookInventoryHistory.<\/p>\n\n\n\n

\u52a0\u5165\u8cc7\u6599<\/strong><\/p>\n\n\n\n

BookInventory\u5148\u52a0\u5165\u5169\u7b46\u8cc7\u6599\u3002<\/p>\n\n\n\n

\"\"<\/figure>\n\n\n\n

dbo.BookInventory<\/p>\n\n\n\n

\"\"<\/figure>\n\n\n\n

dbo.BookInventoryHistory<\/p>\n\n\n\n

\"\"<\/figure>\n\n\n\n

\u52a0\u5165\u5169\u7b46\u8cc7\u6599\u5f8c\uff0c\u5206\u5225\u89c0\u5bdfBookInventory\u8868\u548c\u5b83\u7684temporal table(BookInventoryHistory)\u3002BookInventory\u8868\u5df2\u6709\u9019\u5169\u7b46\u8cc7\u6599\uff0c\u4f46BookInventoryHistory\u9084\u5c1a\u672a\u6709\u525bInsert\u9019\u5169\u7b46\u8cc7\u6599\u3002\u90a3\u662f\u56e0\u70baBookInventory\u7b2c\u4e00\u6b65\u662fInsert\uff0c\u8981\u7b49\u5230\u4e0b\u4e00\u6b65\u5982Update\uff0c\u624d\u6703\u5c07\u539f\u5148BookInventory\u9019\u5169\u7b46\u8cc7\u6599\u52a0\u5165BookInventoryHistory(Temporal table)\u3002<\/p>\n\n\n\n

\u66f4\u65b0\u8cc7\u6599- Step 1<\/strong><\/p>\n\n\n\n

\"\"<\/figure>\n\n\n\n

dbo.BookInventory<\/p>\n\n\n\n

\"\"<\/figure>\n\n\n\n

dbo.BookInventoryHistory<\/p>\n\n\n\n

\"\"<\/figure>\n\n\n\n

\u66f4\u65b0\u539ftable( BookInventory)\u7684\u5169\u7b46\u8cc7\u6599\u5f8c\uff0c\u539fBookInventory\u8868\u5df2\u6709\u66f4\u65b0\u904e\u90a3\u5169\u7b46\u8cc7\u6599\u3002\u63a5\u8005\u6211\u5011\u4e5f\u770b\u5230BookInventoryHistory\u8868\u5df2\u6709\u539f\u5169\u7b46\u88abUpdate\u524d\u7684\u8cc7\u6599\u3002SysStartTime\u70ba\u539f\u59cb\u8cc7\u6599\u751f\u6210\u6642\u9593\uff0cSysEndTime\u70baUpdate(\u7570\u52d5)\u6642\u9593\u3002<\/p>\n\n\n\n

\u66f4\u65b0\u8cc7\u6599- Step 2<\/strong><\/p>\n\n\n\n

\"\"<\/figure>\n\n\n\n
\"\"<\/figure>\n\n\n\n

dbo.BookInventory<\/p>\n\n\n\n

\"\"<\/figure>\n\n\n\n

dbo.BookInventoryHistory<\/p>\n\n\n\n

\"\"<\/figure>\n\n\n\n

\u6211\u5011\u518d\u6e2c\u8a66Update data\u5f8c\u7684\u7d50\u679c\u3002\u9019\u6b21\u7570\u52d5\u7684\u8cc7\u6599\u70ba\u5169\u7b46\uff0c\u6240\u4ee5\u9019\u6b21BookInventoryHistory\u8868\u61c9\u6709\u56db\u7b46\u8cc7\u6599(\u4e0a\u6b21update\u5169\u7b46\u52a0\u4e0a\u9019\u6b21update\u5f8c\u5169\u7b46)\u3002\u57f7\u884cupdate\u5982\u9810\u671f\u3002BookInventoryHistory\u53ef\u8ffd\u8e64\u6bcf\u6b21update\u5f8c\u7684\u8cc7\u6599\u7d50\u679c\uff0c\u5305\u542b\u7570\u52d5\u6642\u9593\u3002<\/p>\n\n\n\n

\u522a\u9664\u8cc7\u6599<\/strong><\/p>\n\n\n\n

\"\"<\/figure>\n\n\n\n

dbo.BookInventory<\/p>\n\n\n\n

\"\"<\/figure>\n\n\n\n

dbo.BookInventoryHistory<\/p>\n\n\n\n

\"\"<\/figure>\n\n\n\n

\u9019\u6b21\u6211\u5011\u522a\u9664\u4e00\u7b46\u8cc7\u6599\u4f86\u6e2c\u8a66Temporal Table\u3002\u5728\u57f7\u884cDelete\u522a\u9664\u8cc7\u6599\u5f8c\uff0cBookInventory\u8868\u53ea\u5269\u4e00\u7b46\u8cc7\u6599(\u53e6\u4e00\u7b46\u5df2\u522a)\u3002\u6211\u5011\u518d\u770bBookInventoryHistory\u8868\uff0c\u767c\u73fe5\u7b46\u8cc7\u6599\u3002\u65b0\u589e\u7684\u4e00\u7b46\u70ba\u525b\u522a\u9664\u524d\u7684\u8cc7\u6599\uff0c\u5305\u542b\u6b64\u8cc7\u6599\u751f\u6210(update)\u548c\u522a\u9664(delete)\u7684\u6642\u9593\u3002<\/p>\n\n\n\n

\u8ffd\u8e64\u8cc7\u6599<\/strong><\/p>\n\n\n\n

\"\"<\/figure>\n\n\n\n

dbo.BookInventory<\/p>\n\n\n\n

\"\"<\/figure>\n\n\n\n

\u6307\u5728 ‘2024-09-02 02:23:57.3447172’ \u6642\u9593\u9ede\u6709\u6548\u7684\u6578\u64da<\/p>\n\n\n\n

\u7d50\u8ad6<\/strong><\/p>\n\n\n\n

Temporal Table\u4e5f\u6709\u4fb7\u9650\u6027\uff0c\u50cf\u662fTemporal Table\u4e0d\u5141\u8a31constraint\uff0c\u4e14Temporal Table\u4e5f\u9700\u8981\u984d\u5916\u8a18\u61b6\u7a7a\u9593\uff0c\u6548\u80fd\u8a2d\u5b9a\u4e5f\u8f03\u8907\u96dc\uff0c\u4f46\u5b83\u5728\u8ffd\u8e64\u6b77\u53f2\u7570\u52d5\u8cc7\u6599\u662f\u5f88\u65b9\u4fbf\u7684\u3002\u5728Sql Server 2016\u4e4b\u524d\u53ef\u80fd\u8981\u7528Trigger\u6216Store Procedure\u4f86\u8ffd\u8e64\u6b77\u53f2\u7570\u52d5\u8cc7\u6599\u3002\u4e0b\u7bc7\u6703\u4ecb\u7d39EntityFramework Core\u95dc\u65bcTemporal Table\u751f\u6210\u548c\u61c9\u7528\u3002<\/p>\n\n\n\n

\u53c3\u8003\u8cc7\u6599<\/strong><\/p>\n\n\n\n

Microsoft Docs, “<\/strong>Temporal Tables<\/strong><\/a>“<\/strong><\/p>\n\n\n\n

Pluralsight Couse <\/strong>Querying Data in EF Core<\/strong><\/a>– <\/strong>Temporal Tables<\/strong><\/a><\/p>\n\n\n\n

The importance of traceability of changes, https:\/\/itequia.com\/en\/table-versioning-in-sql-server-what-is-it-and-how-does-it-work\/<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"

Temporal Table\u662f\u5728SQL SERVER 2016\u63a8\u51fa\u5f8c\u65b0\u52a0\u7684\u529f\u80fd\uff0cTemporal Table\u4e3b\u8981\u529f\u80fd\u662f\u7d00\u9304Table\u6b77\u53f2\u8cc7\u6599\uff0cTemoral Table\u6703\u8a18\u9304\u6bcf\u4e00\u7b46\u6bcf\u4e00\u6642\u523b\u7570\u52d5\u7684\u8cc7\u6599\u3002\u65b0\u7248\u7684EntityFramework Core\u4e5f\u6709Temporal Table\u7684\u529f\u80fd\u3002Temporal Table\u4e3b\u8981\u6709\u4ee5\u4e0b\u9019\u4e9b\u529f\u80fd Auditing: \u5c0d\u65bc\u4e00\u4e9b\u7522\u696d\u5982\u91d1\u878d\u6216\u91ab\u7642\u53ef\u4ee5\u8ffd\u8e64\u6b77\u53f2\u7d00\u9304\uff0c\u770b\u662f\u5426\u6709\u65b0\u589e\u6216\u522a\u9664\u8cc7\u6599\u3002 History Data Analysis: \u53ef\u4ee5\u5206\u6790\u4e00\u4e9b\u516c\u53f8\u7522\u54c1\u6b77\u53f2\u7d00\u9304\uff0c\u4f86\u5224\u65b7\u7522\u54c1\u92b7\u552e\u7d00\u9304(\u5c24\u5176\u5728\u54ea\u4e00\u6642\u6bb5)\u3002\u5728\u5206\u6790\u80a1\u7968\u884c\u60c5\u4e5f\u6709\u7528\u3002 Data recovery: \u4f8b\u5982\u9280\u884c\u6709\u4e9b\u696d\u52d9\u7570\u5e38\u6216\u7279\u6b8a\u5f62\u6cc1\u4e0b\uff0c\u53ef\u8ffd\u8e64\u6b77\u53f2\u8cc7\u6599\u4f86\u5fa9\u539f\u8cc7\u6599\u932f\u8aa4\u3002 \u7bc4\u4f8b: \u5efa\u7acb\u8cc7\u6599\u8868 \u5148\u65b0\u5efatable\u548c\u5b83\u7684temporal table\u3002Table schema\u5982\u4e0b\u3002\u8868\u540d\u7a31\u70baBookInventory\uff0c\u800c\u6b64table\u7684temporal table\u70badbo.BookInventoryHistory\uff0cBookInventoryHistory\u662fSystem-Versioned\uff0cSystem-Versioned\u610f\u601d\u662f\u6307SQL SERVER\u6703\u81ea\u52d5\u7522\u751f\u548c\u7dad\u8b77Historical Table\u3002 GENERATED ALWAYS AS ROW START: \u8cc7\u6599\u5217\u7684\u8d77\u59cb\u6548\u671f GENERATED ALWAYS AS ROW END: \u8cc7\u6599\u5217\u7684\u7d50\u675f\u6548\u671f  PERIOD FOR SYSTEM_TIME :\u4ee3\u8868\u6548\u671f\u7684\u8d77\u59cb\u8207\u7d42\u9ede SYSTEM_VERSIONING = ON (HISTORY_TABLE = dbo.BookInventoryHistory): \u555f\u7528 Temporal Table\u751f\u6548, Temporal Table\u70ba BookInventoryHistory. \u52a0\u5165\u8cc7\u6599 BookInventory\u5148\u52a0\u5165\u5169\u7b46\u8cc7\u6599\u3002 dbo.BookInventory […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"nf_dc_page":"","om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"set","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[40],"tags":[],"class_list":["post-974","post","type-post","status-publish","format-standard","hentry","category-database-2"],"yoast_head":"\nSQL SERVER Temporal Table - Who said turtle cannot fly<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/turtleflyblog.com\/zh\/2025\/01\/10\/sql-server-temporal-table-2\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"SQL SERVER Temporal Table - Who said turtle cannot fly\" \/>\n<meta property=\"og:description\" content=\"Temporal Table\u662f\u5728SQL SERVER 2016\u63a8\u51fa\u5f8c\u65b0\u52a0\u7684\u529f\u80fd\uff0cTemporal Table\u4e3b\u8981\u529f\u80fd\u662f\u7d00\u9304Table\u6b77\u53f2\u8cc7\u6599\uff0cTemoral Table\u6703\u8a18\u9304\u6bcf\u4e00\u7b46\u6bcf\u4e00\u6642\u523b\u7570\u52d5\u7684\u8cc7\u6599\u3002\u65b0\u7248\u7684EntityFramework Core\u4e5f\u6709Temporal Table\u7684\u529f\u80fd\u3002Temporal Table\u4e3b\u8981\u6709\u4ee5\u4e0b\u9019\u4e9b\u529f\u80fd Auditing: \u5c0d\u65bc\u4e00\u4e9b\u7522\u696d\u5982\u91d1\u878d\u6216\u91ab\u7642\u53ef\u4ee5\u8ffd\u8e64\u6b77\u53f2\u7d00\u9304\uff0c\u770b\u662f\u5426\u6709\u65b0\u589e\u6216\u522a\u9664\u8cc7\u6599\u3002 History Data Analysis: \u53ef\u4ee5\u5206\u6790\u4e00\u4e9b\u516c\u53f8\u7522\u54c1\u6b77\u53f2\u7d00\u9304\uff0c\u4f86\u5224\u65b7\u7522\u54c1\u92b7\u552e\u7d00\u9304(\u5c24\u5176\u5728\u54ea\u4e00\u6642\u6bb5)\u3002\u5728\u5206\u6790\u80a1\u7968\u884c\u60c5\u4e5f\u6709\u7528\u3002 Data recovery: \u4f8b\u5982\u9280\u884c\u6709\u4e9b\u696d\u52d9\u7570\u5e38\u6216\u7279\u6b8a\u5f62\u6cc1\u4e0b\uff0c\u53ef\u8ffd\u8e64\u6b77\u53f2\u8cc7\u6599\u4f86\u5fa9\u539f\u8cc7\u6599\u932f\u8aa4\u3002 \u7bc4\u4f8b: \u5efa\u7acb\u8cc7\u6599\u8868 \u5148\u65b0\u5efatable\u548c\u5b83\u7684temporal table\u3002Table schema\u5982\u4e0b\u3002\u8868\u540d\u7a31\u70baBookInventory\uff0c\u800c\u6b64table\u7684temporal table\u70badbo.BookInventoryHistory\uff0cBookInventoryHistory\u662fSystem-Versioned\uff0cSystem-Versioned\u610f\u601d\u662f\u6307SQL SERVER\u6703\u81ea\u52d5\u7522\u751f\u548c\u7dad\u8b77Historical Table\u3002 GENERATED ALWAYS AS ROW START: \u8cc7\u6599\u5217\u7684\u8d77\u59cb\u6548\u671f GENERATED ALWAYS AS ROW END: \u8cc7\u6599\u5217\u7684\u7d50\u675f\u6548\u671f  PERIOD FOR SYSTEM_TIME :\u4ee3\u8868\u6548\u671f\u7684\u8d77\u59cb\u8207\u7d42\u9ede SYSTEM_VERSIONING = ON (HISTORY_TABLE = dbo.BookInventoryHistory): \u555f\u7528 Temporal Table\u751f\u6548, Temporal Table\u70ba BookInventoryHistory. \u52a0\u5165\u8cc7\u6599 BookInventory\u5148\u52a0\u5165\u5169\u7b46\u8cc7\u6599\u3002 dbo.BookInventory […]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/turtleflyblog.com\/zh\/2025\/01\/10\/sql-server-temporal-table-2\/\" \/>\n<meta property=\"og:site_name\" content=\"Who said turtle cannot fly\" \/>\n<meta property=\"article:published_time\" content=\"2025-01-10T00:41:24+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-01-10T01:20:52+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/turtleflyblog.com\/wp-content\/uploads\/2025\/01\/image-17.png\" \/>\n<meta name=\"author\" content=\"Joseph\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Joseph\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/turtleflyblog.com\/zh\/2025\/01\/10\/sql-server-temporal-table-2\/\",\"url\":\"https:\/\/turtleflyblog.com\/zh\/2025\/01\/10\/sql-server-temporal-table-2\/\",\"name\":\"SQL SERVER Temporal Table - Who said turtle cannot fly\",\"isPartOf\":{\"@id\":\"https:\/\/turtleflyblog.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/turtleflyblog.com\/zh\/2025\/01\/10\/sql-server-temporal-table-2\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/turtleflyblog.com\/zh\/2025\/01\/10\/sql-server-temporal-table-2\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/turtleflyblog.com\/wp-content\/uploads\/2025\/01\/image-17.png\",\"datePublished\":\"2025-01-10T00:41:24+00:00\",\"dateModified\":\"2025-01-10T01:20:52+00:00\",\"author\":{\"@id\":\"https:\/\/turtleflyblog.com\/#\/schema\/person\/130c2e1bdce4a8ba27bfe14c65988172\"},\"breadcrumb\":{\"@id\":\"https:\/\/turtleflyblog.com\/zh\/2025\/01\/10\/sql-server-temporal-table-2\/#breadcrumb\"},\"inLanguage\":\"en-AU\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/turtleflyblog.com\/zh\/2025\/01\/10\/sql-server-temporal-table-2\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-AU\",\"@id\":\"https:\/\/turtleflyblog.com\/zh\/2025\/01\/10\/sql-server-temporal-table-2\/#primaryimage\",\"url\":\"https:\/\/i0.wp.com\/turtleflyblog.com\/wp-content\/uploads\/2025\/01\/image-17.png?fit=864%2C459&ssl=1\",\"contentUrl\":\"https:\/\/i0.wp.com\/turtleflyblog.com\/wp-content\/uploads\/2025\/01\/image-17.png?fit=864%2C459&ssl=1\",\"width\":864,\"height\":459},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/turtleflyblog.com\/zh\/2025\/01\/10\/sql-server-temporal-table-2\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/turtleflyblog.com\/en\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"SQL SERVER Temporal Table\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/turtleflyblog.com\/#website\",\"url\":\"https:\/\/turtleflyblog.com\/\",\"name\":\"Who said turtle cannot fly\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/turtleflyblog.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-AU\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/turtleflyblog.com\/#\/schema\/person\/130c2e1bdce4a8ba27bfe14c65988172\",\"name\":\"Joseph\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-AU\",\"@id\":\"https:\/\/turtleflyblog.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/539caa7bc4af75cd4ab82fc8d51935da?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/539caa7bc4af75cd4ab82fc8d51935da?s=96&d=mm&r=g\",\"caption\":\"Joseph\"},\"sameAs\":[\"https:\/\/turtleflyblog.com\/\/\"],\"url\":\"https:\/\/turtleflyblog.com\/author\/joseph\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"SQL SERVER Temporal Table - Who said turtle cannot fly","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/turtleflyblog.com\/zh\/2025\/01\/10\/sql-server-temporal-table-2\/","og_locale":"en_US","og_type":"article","og_title":"SQL SERVER Temporal Table - Who said turtle cannot fly","og_description":"Temporal Table\u662f\u5728SQL SERVER 2016\u63a8\u51fa\u5f8c\u65b0\u52a0\u7684\u529f\u80fd\uff0cTemporal Table\u4e3b\u8981\u529f\u80fd\u662f\u7d00\u9304Table\u6b77\u53f2\u8cc7\u6599\uff0cTemoral Table\u6703\u8a18\u9304\u6bcf\u4e00\u7b46\u6bcf\u4e00\u6642\u523b\u7570\u52d5\u7684\u8cc7\u6599\u3002\u65b0\u7248\u7684EntityFramework Core\u4e5f\u6709Temporal Table\u7684\u529f\u80fd\u3002Temporal Table\u4e3b\u8981\u6709\u4ee5\u4e0b\u9019\u4e9b\u529f\u80fd Auditing: \u5c0d\u65bc\u4e00\u4e9b\u7522\u696d\u5982\u91d1\u878d\u6216\u91ab\u7642\u53ef\u4ee5\u8ffd\u8e64\u6b77\u53f2\u7d00\u9304\uff0c\u770b\u662f\u5426\u6709\u65b0\u589e\u6216\u522a\u9664\u8cc7\u6599\u3002 History Data Analysis: \u53ef\u4ee5\u5206\u6790\u4e00\u4e9b\u516c\u53f8\u7522\u54c1\u6b77\u53f2\u7d00\u9304\uff0c\u4f86\u5224\u65b7\u7522\u54c1\u92b7\u552e\u7d00\u9304(\u5c24\u5176\u5728\u54ea\u4e00\u6642\u6bb5)\u3002\u5728\u5206\u6790\u80a1\u7968\u884c\u60c5\u4e5f\u6709\u7528\u3002 Data recovery: \u4f8b\u5982\u9280\u884c\u6709\u4e9b\u696d\u52d9\u7570\u5e38\u6216\u7279\u6b8a\u5f62\u6cc1\u4e0b\uff0c\u53ef\u8ffd\u8e64\u6b77\u53f2\u8cc7\u6599\u4f86\u5fa9\u539f\u8cc7\u6599\u932f\u8aa4\u3002 \u7bc4\u4f8b: \u5efa\u7acb\u8cc7\u6599\u8868 \u5148\u65b0\u5efatable\u548c\u5b83\u7684temporal table\u3002Table schema\u5982\u4e0b\u3002\u8868\u540d\u7a31\u70baBookInventory\uff0c\u800c\u6b64table\u7684temporal table\u70badbo.BookInventoryHistory\uff0cBookInventoryHistory\u662fSystem-Versioned\uff0cSystem-Versioned\u610f\u601d\u662f\u6307SQL SERVER\u6703\u81ea\u52d5\u7522\u751f\u548c\u7dad\u8b77Historical Table\u3002 GENERATED ALWAYS AS ROW START: \u8cc7\u6599\u5217\u7684\u8d77\u59cb\u6548\u671f GENERATED ALWAYS AS ROW END: \u8cc7\u6599\u5217\u7684\u7d50\u675f\u6548\u671f  PERIOD FOR SYSTEM_TIME :\u4ee3\u8868\u6548\u671f\u7684\u8d77\u59cb\u8207\u7d42\u9ede SYSTEM_VERSIONING = ON (HISTORY_TABLE = dbo.BookInventoryHistory): \u555f\u7528 Temporal Table\u751f\u6548, Temporal Table\u70ba BookInventoryHistory. \u52a0\u5165\u8cc7\u6599 BookInventory\u5148\u52a0\u5165\u5169\u7b46\u8cc7\u6599\u3002 dbo.BookInventory […]","og_url":"https:\/\/turtleflyblog.com\/zh\/2025\/01\/10\/sql-server-temporal-table-2\/","og_site_name":"Who said turtle cannot fly","article_published_time":"2025-01-10T00:41:24+00:00","article_modified_time":"2025-01-10T01:20:52+00:00","og_image":[{"url":"https:\/\/turtleflyblog.com\/wp-content\/uploads\/2025\/01\/image-17.png","type":"","width":"","height":""}],"author":"Joseph","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Joseph","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/turtleflyblog.com\/zh\/2025\/01\/10\/sql-server-temporal-table-2\/","url":"https:\/\/turtleflyblog.com\/zh\/2025\/01\/10\/sql-server-temporal-table-2\/","name":"SQL SERVER Temporal Table - Who said turtle cannot fly","isPartOf":{"@id":"https:\/\/turtleflyblog.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/turtleflyblog.com\/zh\/2025\/01\/10\/sql-server-temporal-table-2\/#primaryimage"},"image":{"@id":"https:\/\/turtleflyblog.com\/zh\/2025\/01\/10\/sql-server-temporal-table-2\/#primaryimage"},"thumbnailUrl":"https:\/\/turtleflyblog.com\/wp-content\/uploads\/2025\/01\/image-17.png","datePublished":"2025-01-10T00:41:24+00:00","dateModified":"2025-01-10T01:20:52+00:00","author":{"@id":"https:\/\/turtleflyblog.com\/#\/schema\/person\/130c2e1bdce4a8ba27bfe14c65988172"},"breadcrumb":{"@id":"https:\/\/turtleflyblog.com\/zh\/2025\/01\/10\/sql-server-temporal-table-2\/#breadcrumb"},"inLanguage":"en-AU","potentialAction":[{"@type":"ReadAction","target":["https:\/\/turtleflyblog.com\/zh\/2025\/01\/10\/sql-server-temporal-table-2\/"]}]},{"@type":"ImageObject","inLanguage":"en-AU","@id":"https:\/\/turtleflyblog.com\/zh\/2025\/01\/10\/sql-server-temporal-table-2\/#primaryimage","url":"https:\/\/i0.wp.com\/turtleflyblog.com\/wp-content\/uploads\/2025\/01\/image-17.png?fit=864%2C459&ssl=1","contentUrl":"https:\/\/i0.wp.com\/turtleflyblog.com\/wp-content\/uploads\/2025\/01\/image-17.png?fit=864%2C459&ssl=1","width":864,"height":459},{"@type":"BreadcrumbList","@id":"https:\/\/turtleflyblog.com\/zh\/2025\/01\/10\/sql-server-temporal-table-2\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/turtleflyblog.com\/en\/"},{"@type":"ListItem","position":2,"name":"SQL SERVER Temporal Table"}]},{"@type":"WebSite","@id":"https:\/\/turtleflyblog.com\/#website","url":"https:\/\/turtleflyblog.com\/","name":"Who said turtle cannot fly","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/turtleflyblog.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-AU"},{"@type":"Person","@id":"https:\/\/turtleflyblog.com\/#\/schema\/person\/130c2e1bdce4a8ba27bfe14c65988172","name":"Joseph","image":{"@type":"ImageObject","inLanguage":"en-AU","@id":"https:\/\/turtleflyblog.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/539caa7bc4af75cd4ab82fc8d51935da?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/539caa7bc4af75cd4ab82fc8d51935da?s=96&d=mm&r=g","caption":"Joseph"},"sameAs":["https:\/\/turtleflyblog.com\/\/"],"url":"https:\/\/turtleflyblog.com\/author\/joseph\/"}]}},"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/turtleflyblog.com\/wp-json\/wp\/v2\/posts\/974","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/turtleflyblog.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/turtleflyblog.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/turtleflyblog.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/turtleflyblog.com\/wp-json\/wp\/v2\/comments?post=974"}],"version-history":[{"count":1,"href":"https:\/\/turtleflyblog.com\/wp-json\/wp\/v2\/posts\/974\/revisions"}],"predecessor-version":[{"id":992,"href":"https:\/\/turtleflyblog.com\/wp-json\/wp\/v2\/posts\/974\/revisions\/992"}],"wp:attachment":[{"href":"https:\/\/turtleflyblog.com\/wp-json\/wp\/v2\/media?parent=974"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/turtleflyblog.com\/wp-json\/wp\/v2\/categories?post=974"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/turtleflyblog.com\/wp-json\/wp\/v2\/tags?post=974"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}