0

Anyone please tell me how to store n x n matrix data into SQL Server 2008?

I want to store thousand of pieces of data into SQL Server at the same time from my ASP.NET page so if I pass an array of row and column then how can I store at the same time in SQL Server

Thanks in advance

1
  • Read up about Table-Valued Parameters on MSDN. This might help you if your n x n matrix will always be the same dimensions. Commented Nov 8, 2012 at 7:46

2 Answers 2

2

SQL Server is a relational database, data should at least in 3NF. This means that attributes can't be multivaluates. To store data as you required you have several options:

  • Normalize data and store it in tables.
  • Store data array as an XML field.
  • Move to NOSQL DBMS or any that supports multivalue.
Sign up to request clarification or add additional context in comments.

Comments

0

You can set up a stored procedure and pass a DataTable as a parameter to the stored procedure. In your procedure you can then execute a INSERT statement with the data from your DataTable. All you have to do is create and fill your DataTable before you execute the stored procedure.

Here is a link on how to do that. It's written in C# I figured since you're talking about ASP.net this might be it for you.. it should also be easy enough to translate the snippet in VB.net if that's what you're using. http://www.codeproject.com/Tips/214492/Passing-a-datatable-to-a-stored-procedure-in-Sql-S

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.