Storing array of integer values in SQL Server

spoekes picture spoekes · Oct 27, 2010 · Viewed 20.3k times · Source

i want to store an array of integer values in a SQL database table (SQLServer 2005), if possible by using a single column.

The integer array will have a length of 7560 values.

I am using a objectdatasource, the datatype should be compatible with the generated parameters of a tableadapter.

thanks for helping :)

Answer

Mark Byers picture Mark Byers · Oct 27, 2010

You have at least two choices:

  • Store it as a comma separated list of values.
  • Use a separate table and store one value per row, with a foreign key pointing back to your table.

If you want to normalize your database you should take the second option.