c# - Insert 150 columns in a single table using stored procedures -


we have requirement use stored procedure update/insert data in sql table.

i can create stored procedure update 150 columns, require need take 150 columns values object have , explicitly pass 150 columns stored procedure.

can please suggest way in don't have pass 150 values explicitly ?

the other answers here have shown alternative ways accomplish goal. however, caution against use several reasons.

  1. most brittle. meaning have potential problems not show compile time and, in many cases, won't show unless every single edge case tested.

  2. most result in same or more code. aren't saving code having parse string or turning xml file temp table prior updating/inserting main table.

  3. the non-standard ways means next programmer on project going need pay attention fact procedure operates differently others no other reason save few lines of c# code.

point is, go ahead , create stored procedure usual way , call usual way. issues show in compile time or limited test cases. further keeping same format other code increasing likelihood future changes successful without lot of work.


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -