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 |
|
sudhirbharti
Starting Member
16 Posts |
Posted - 2009-03-26 : 06:48:22
|
| i have two column in a table like followingcol1 col20 00 50 100 151 01 51 101 15now what my requirement is to check the interval of 5 in col2, if the sequence is not matched in col2 like thiscol1 col20 00 50 110 151 01 31 111 4then it update the col2 on interval of 5. like thiscol1 col20 00 50 100 151 01 51 101 15Any Ideas? |
|
|
matty
Posting Yak Master
161 Posts |
Posted - 2009-03-26 : 07:34:46
|
| declare @t table( col1 int, col2 int)insert @tselect 0, 0 union allselect 0, 5 union allselect 0, 11 union allselect 0, 15 union allselect 1, 0 union allselect 1, 3 union allselect 1, 11 union allselect 1, 4 SELECT a.col1,rownum * 5FROM( SELECT col1,row_number() OVER(PARTITION BY col1 ORDER BY col1) AS rownum FROM @t)a |
 |
|
|
|
|
|