C# SQL: What is the best way to implement a dynamic table?

Posted by SirMoreno on Stack Overflow See other posts from Stack Overflow or by SirMoreno
Published on 2010-04-12T14:58:28Z Indexed on 2010/04/12 15:03 UTC
Read the original article Hit count: 231

Filed under:
|
|
|

I want to allow the user to add columns to a table in the UI.

The UI: Columns Name:__ Columns Type: Number/String/Date

My Question is how to build the SQL tables and C# objects so the implementation will be efficient and scalable.


My thought is to build two SQL tables:

TBL 1 - ColumnsDefinition:

ColId, ColName, ColType[Text]

TBL 2 - ColumnsValues:

RowId, ColId, Value [Text]


I want the solution to be efficient in DB space,

and I want to allow the user to sort the dynamic columns.

I work on .NET 3.5 MSSQL 2008.

Thanks.

© Stack Overflow or respective owner

Related posts about c#

Related posts about sql