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 |
Noejfah
Starting Member
5 Posts |
Posted - 2013-05-29 : 07:24:58
|
WHere PP_prev = PP_next , how do i replace everything below it with the hash('-') for the same cl_key. INother word where ever PP_prev = PP_next for each cl_key it needs to make everything below PP_next = hash('-').sample of data:cl_key acc_key mth PP RowNum PP_prev PP_next3994 25 201205 $ 1 $ 03994 25 201206 0 2 0 03994 25 201207 0 3 0 U3994 25 201208 U 4 U U3994 25 201209 U 5 U U3994 25 201210 U 6 U U3994 25 201211 U 7 U U3994 25 201212 U 8 U U3994 25 201301 U 9 U U3994 25 201302 U 10 U U3994 25 201303 U 11 U U3994 25 201304 U 12 U NULL3994 42 201205 0 13 0 -3994 42 201206 - 14 - -3994 42 201207 - 15 - U3994 42 201208 U 16 U U3994 42 201209 U 17 U U3994 42 201210 U 18 U U3994 42 201211 U 19 U U3994 42 201212 U 20 U U3994 42 201301 U 21 U U3994 42 201302 U 22 U U3994 42 201303 U 23 U U3994 42 201304 U 24 U NULL3994 69 201205 x 25 x 03994 69 201206 0 26 0 03994 69 201207 0 27 0 U3994 69 201208 U 28 U U3994 69 201209 U 29 U U3994 69 201210 U 30 U U3994 69 201211 U 31 U U3994 69 201212 U 32 U U3994 69 201301 U 33 U U3994 69 201302 U 34 U U3994 69 201303 U 35 U U3994 69 201304 U 36 U NULL/***************************************/this is what it needs to look like:cl_key acc_key mth PP RowNum PP_prev PP_next3994 25 201205 $ 1 $ 03994 25 201206 0 2 0 03994 25 201207 0 3 0 U3994 25 201208 U 4 U U3994 25 201209 U 5 U U3994 25 201210 U 6 U U3994 25 201211 U 7 U U3994 25 201212 U 8 U U3994 25 201301 U 9 U U3994 25 201302 U 10 U U3994 25 201303 U 11 U U3994 25 201304 U 12 U NULL3994 42 201205 0 13 0 -3994 42 201206 - 14 - -3994 42 201207 - 15 - -3994 42 201208 U 16 U -3994 42 201209 U 17 U -3994 42 201210 U 18 U -3994 42 201211 U 19 U -3994 42 201212 U 20 U -3994 42 201301 U 21 U -3994 42 201302 U 22 U -3994 42 201303 U 23 U -3994 42 201304 U 24 U -3994 69 201205 x 25 x -3994 69 201206 0 26 0 -3994 69 201207 0 27 0 -3994 69 201208 U 28 U -3994 69 201209 U 29 U -3994 69 201210 U 30 U -3994 69 201211 U 31 U -3994 69 201212 U 32 U -3994 69 201301 U 33 U -3994 69 201302 U 34 U -3994 69 201303 U 35 U -3994 69 201304 U 36 U - |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-05-29 : 07:44:14
|
why is it not changed for RowNum 4, 5 etc? they also have PP_prev = PP_next------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
 |
|
MIK_2008
Master Smack Fu Yak Hacker
1054 Posts |
Posted - 2013-05-29 : 07:44:17
|
Can you reduce the number of sample records (to three or four) and then provide the desired ouput (you're looking) for those fewer records?CheersMIK |
 |
|
|
|
|