0
我使用SQL Server 2012,我的表的名稱是 「TableX的」,它已經COLOR_ID和有第二個表 「colortable1 [COLOR_ID]」 =關鍵是COLOR_ID指向colortable1,SQL邏輯約束
現在我們有太多的顏色,我們必須存檔其中的一些。 我們分裂colortable成2個色表:
colortable1(color_id is 1-100)
colortable2 (color_id is 100-100000)
分割的TableX不會找到IDS從colortable1 被拆除,經過和我需要以某種方式設置的邏輯:
if id is 1-100 then color_id is from colortable1
if id is 100-100000 then color_id is from colortable2
怎麼能這樣在SQL中完成?
SQL-2011是ANSI SQL標準,沒有SQL-2012標準。 – jarlh
100,000行不是很大。您應該能夠解決表分區或索引的性能問題,而不必訴諸使用單獨的表。 –
什麼是您的SQL Server版本?是標準版還是企業版? –