我在MS Access 2013中創建了一個只有一列」長文本「稱之爲備忘錄),並將其作爲表格的主鍵。我存儲了一串長度超過255個字符,然後嘗試存儲另一個字符串,其中前255個字符與先前存儲的字符串相同,但前255個字符後的所有其他字符都不相同,並且MS Access出現「重複數據」錯誤。在新的字符串中,我改變了第255個位置後的字符,使用了不同的字符組合,並且都發生了錯誤。但是當我在第255個位置之前改變任何字符時,它不會給出任何錯誤。因此,我斷定MS Access只檢查「長文本」數據類型的前255個字符,以檢查該列中的重複項。是這樣嗎?還有什麼可能是理由?當它是一個主鍵字段或「索引:是(無重複)允許」時,將長文本/備忘錄字符串截斷爲255個字符「
字符串存儲的256個字符: LoremIpsumissimplydummytextoftheprintingandtypesettingindustryLoremIpsumhasbeentheindustrysstandarddummytexteversincethe1500swhenanunknownprintertookagalleyoftypeandscrambledittomakeatypespecimenbookIthassurvivednotonlyfivecenturiesbutalsotheleapintoelectr
字符串給了錯誤: LoremIpsumissimplydummytextoftheprintingandtypesettingindustryLoremIpsumhasbeentheindustrysstandarddummytexteversincethe1500swhenanunknownprintertookagalleyoftypeandscrambledittomakeatypespecimenbookIthassurvivednotonlyfivecenturiesbutalsotheleapintoelect1
S飾吳給了錯誤: LoremIpsumissimplydummytextoftheprintingandtypesettingindustryLoremIpsumhasbeentheindustrysstandarddummytexteversincethe1500swhenanunknownprintertookagalleyoftypeandscrambledittomakeatypespecimenbookIthassurvivednotonlyfivecenturiesbutalsotheleapintoelect2
字符串給了錯誤: LoremIpsumissimplydummytextoftheprintingandtypesettingindustryLoremIpsumhasbeentheindustrysstandarddummytexteversincethe1500swhenanunknownprintertookagalleyoftypeandscrambledittomakeatypespecimenbookIthassurvivednotonlyfivecenturiesbutalsotheleapintoelect123
不給錯誤: LoremIpsumissimplydummytextoftheprintingandtypesettingindustryLoremIpsumhasbeentheindustr ysstandarddummytexteversincethe1500swhenanunknownprintertookagalleyoftypeandscrambledittomakeatypespecimenbookIthassurvivednotonlyfivecenturiesbutalsotheleapintoelec1
不給錯誤: LoremIpsumissimplydummytextoftheprintingandtypesettingindustryLoremIpsumhasbeentheindustrysstandarddummytexteversincethe1500swhenanunknownprintertookagalleyoftypeandscrambledittomakeatypespecimenbookIthassurvivednotonlyfivecenturiesbutalsotheleapintoelec2
不給錯誤: LoremIpsumissimplydummytextoftheprintingandtypesettingindustryLoremIpsumhasbeentheindustrysstandarddummytexteversincethe1500swhenanunknownprintertookagalleyoftypeandscrambledittomakeatypespecimenbookIthassurvivednotonlyfivecent uriesbutalsotheleapintoelec3
請注意以上樣品的最後幾個字符的差異。第一個存儲的字符串有256個字符。即使列不是主鍵,如果「索引:是(無重複)允許」,該列的表設計中的值設置爲true,但問題仍然存在。
旁邊的問題:爲什麼你要一個*長文本*字段的主鍵?爲什麼不使用自動編號字段?你是否真的要加入這個領域,還是你想限制它獨特的文字? – LittleBobbyTables
@LittleBobbyTables是的,它是獨特的文字。即使它不是主鍵,如果該列的表設計中設置了無重複值允許值,問題依然存在。 –
索引備忘錄字段是一個不穩固的命題。索引鍵僅使用備註字段值中的前255個字符。 – HansUp