Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 How to Store Array in table

Author  Topic 

gp343
Starting Member

2 Posts

Posted - 2004-03-24 : 08:36:45
Hi there,
I'm a newbie and was wondering how do i store a list of array to a table for later retrieval. See, i'm doing my final year project and have got a Two(2) dimensional array. Each dimension hold approx. 2285 values. This is why i need to know how to store such data.

Any help would be highly appreciated.

James

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2004-03-24 : 09:18:30
Since in an array the ordinal position of the data in each dimension is important, my take is you would store it like this:

ArrayTable
-----------
Dimension1 int
Dimension2 int
Value varchar(10) {or whatever}

... with a PK of (Dimension1, Dimension2) .

Rename the two dimension columns to "X" and "Y" or whatever makes more sense for your data, as well as the "Value" column.

This will then return the value at (2,3):

SELECT Value
FROM Array
WHERE Dimension1 = 2 and Dimension2= 3

- Jeff
Go to Top of Page
   

- Advertisement -