Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
rafeequddin_ahmed
Starting Member
23 Posts |
Posted - 2011-09-29 : 10:17:20
|
| Hi,I have a table where we keep the column name,old value ,new value and key and the talbe name , for the same key of a table we can have multipe row. I need to create single update statment by using multipe rows.A tableID ProcessID columnname oldvalue newvalue Key tablename 1 201 slv 2 4 234 Silver2 201 des Used selected 234 Silver3 201 unit 1 3 234 SilverI have to create a update query as below for the above three recordsUpdate Silver set slv = 4,des = 'selected',unit = 3 where Key = 234 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-09-29 : 12:25:47
|
| no other way other than to use dynamic sql unless your column and table names are fixed------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|