Monday, 9 September 2013

MS T-SQL : Modify table based on dynamic column list

MS T-SQL : Modify table based on dynamic column list

I am using ASP.Net with MS SQL server 2008. I have a scenario where user
can update particular OR all fields. Hence, my optimum solution would be
to create a Stored Procedure, in such a way so that I can pass the column
name and their corresponding values, and update the table.
One way I know is to create the Whole SQL on front end, dynamically, as
string and pass it to the SP. Else create the Dynamic string in DB, inside
SP. But, is that the best option, or can there be a more optimised way.
( I would like to do this in one database trip ) Will appreciate any
response that can point me to the right direction.
Thanks in advance...!

No comments:

Post a Comment