在ms sql server 2005中存储数组或向量

在ms sql server 2005中存储数组或向量,sql,sql-server,sql-server-2005,tsql,sql-server-2008,Sql,Sql Server,Sql Server 2005,Tsql,Sql Server 2008,有人知道如何在ms sql server 2005中存储数组或向量吗?有办法在oracle数据库中存储阵列,但我不知道sql server 例如: 如上所述,st_mk(向量大小)不同 请帮帮我 在单独的子表中 create table Vector(st_id int primary key) create table VectorElement ( st_id int references Vector(st_id), element int ) create index

有人知道如何在ms sql server 2005中存储数组或向量吗?有办法在oracle数据库中存储阵列,但我不知道sql server

例如:

如上所述,st_mk(向量大小)不同


请帮帮我

在单独的子表中

create table Vector(st_id int primary key)

create table VectorElement
(
    st_id int references Vector(st_id),
    element int
)

create index IX_VectorElement_st_id on VectorElement(st_id)

insert Vector
values(1234)

insert VectorElement
select 1234, 12 union all
select 1234, 34 union all
select 1234, 67 union all
select 1234, 45
另一个将其存储为字符串的选项(
varchar
),但效率较低,需要对其进行解析


另一种选择是使用。

我认为VectoreElement需要一个序号列来维护列表元素的顺序。
create table Vector(st_id int primary key)

create table VectorElement
(
    st_id int references Vector(st_id),
    element int
)

create index IX_VectorElement_st_id on VectorElement(st_id)

insert Vector
values(1234)

insert VectorElement
select 1234, 12 union all
select 1234, 34 union all
select 1234, 67 union all
select 1234, 45