简体   繁体   English

存储数组的字段的数据类型应该是什么

[英]what should be the datatype of field to store arrays

I want to store an array (say for example 20*20) in ms sql server,then what should be the datatype of the same? 我想在ms sql server中存储一个数组(例如20 * 20),那么相同的数据类型应该是什么? The table is test and fields are ID,focus,name. 该表是测试,字段是ID,焦点,名称。 I want to store arrays in focus field. 我想将数组存储在焦点字段中。 Please tell me how to do that 请告诉我该怎么做

You shouldn't. 你不应该

You should create a separate table (eg: testfocus) with a row for each element of your array, and a foreign key to your test table. 您应该创建一个单独的表(例如:testfocus),其中每个数组元素都带有一行,并带有测试表的外键。

See https://en.wikipedia.org/wiki/Database_normalization 参见https://en.wikipedia.org/wiki/Database_normalization

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM