| Author |
Topic |
|
maya_zakry
Constraint Violating Yak Guru
379 Posts |
Posted - 2007-01-05 : 21:38:38
|
| hi all, how to update a column to the column itself?i mean i have the scenario that i need to update 10 column at a time but actually 3 will need the real update, the rest i need to reserved the value. My SP will send value s1 til s10 param.. the Q is what value i need to assign to s1 if i want to reserved the old value? maybe something like...UPDATE tblblabalSET s1=??, s2='change2something', s3='change2something'til s10maybe u would ask, why update s1 if u dun wanna update it? it's because i need to prepare for 'needtochange' scenario from my codebehind(vb.net).. |
|
|
maya_zakry
Constraint Violating Yak Guru
379 Posts |
Posted - 2007-01-05 : 21:48:19
|
| this would be no prob without any param..(direct sql)UPDATE tblblabalSET s1=s1 <--- setting to its column name will change nothings2='change2something',s3='change2something'but then if in the stored proc, how do i set the param valum to the column name in my codebehind????my SP:-@s1 as varchar(10),@s2 as varchar(10),@s3 as varchar(10),how to set the @s1 to the name of the table column from the codebehind??escape char?? |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-01-05 : 23:38:23
|
| Before trying this make sure you have backup of that tableSend NULL value to that S1 provided your Sp isCreate Procedure Test(@s1 as varchar(10),@s2 as varchar(10),@s3 as varchar(10)) asUPDATE tblblabalSET s1=ISNULL(@s1,s1)s2='change2something',s3='change2something'Now Execute SP byEXEC Test NULL,'somevalue','somevalue'MadhivananFailing to plan is Planning to fail |
 |
|
|
maya_zakry
Constraint Violating Yak Guru
379 Posts |
Posted - 2007-01-08 : 02:59:10
|
| hi madhivanan..this seems to work, but it doesnt.. i dunno what's wrong, it keeps entering null intead of old value |
 |
|
|
maya_zakry
Constraint Violating Yak Guru
379 Posts |
Posted - 2007-01-08 : 03:12:07
|
| finally it works, tq ! but another Q :-how do we send null value from the codebehind? (vb.net?> |
 |
|
|
maya_zakry
Constraint Violating Yak Guru
379 Posts |
Posted - 2007-01-08 : 03:15:54
|
| System.DBNull.Value |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-01-08 : 09:27:36
|
Glad that you helped yourself MadhivananFailing to plan is Planning to fail |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-01-08 : 09:28:52
|
Glad that you helped yourself MadhivananFailing to plan is Planning to fail |
 |
|
|
maya_zakry
Constraint Violating Yak Guru
379 Posts |
Posted - 2007-01-09 : 03:05:39
|
| :P~~~Focus on problem, not solution~~~ |
 |
|
|
|