Anyone knows how to store array or vector in ms sql server 2005? There is way to store array in oracle db but I don't know about sql server.
eg:
st_id [1234]
st_mk [(12),(34),(67),(45)]
st_id [3456]
st_mk [(12),(34)]开发者_JAVA百科
Like above st_mk
(the vector size) is not same.
Please help me...!!
In a separate child table?
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
Another option to store it as a string (varchar
), but this is less efficient and you would need to parse it.
Another option is to use XML type column.
精彩评论