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 |
|
Vaishu
Posting Yak Master
178 Posts |
Posted - 2008-01-21 : 17:36:51
|
| HII have table with 20 columns. One of the column(col1) in the table has value like belowCol1 -----------Col2123------------- 2123--------------4123--------------6453--------------2898--------------2723--------------2723--------------4How to do insert or update increment of 2 in a column (col2) for every same value in the Col1? I am using Access. Is it possible to with the query ? |
|
|
TG
Master Smack Fu Yak Hacker
6065 Posts |
Posted - 2008-01-21 : 17:57:49
|
quote: Originally posted by Vaishu HII have table with 20 columns. One of the column(col1) in the table has value like belowCol1 -----------Col2123------------- 2123--------------4123--------------6453--------------2898--------------2723--------------2723--------------4How to do insert or update increment of 2 in a column (col2) for every same value in the Col1? I am using Access. Is it possible to with the query ?
If you are looking for a solution for MS Access, there is a sererate forum for that. This forum is for MS Sql Server.Be One with the OptimizerTG |
 |
|
|
sundaram_r_1984
Starting Member
11 Posts |
Posted - 2008-01-22 : 01:56:52
|
| IT WILL WORK IF YOU ARE USING ASP & MSACCESS.. ONLY FOR ADDING NEW RECORDcol1 = 123rs.open "select top 1 * from <tablename> where col1 = 123 order by col2 desc",con,2,3if not rs.eof thenpreviousValue = rs("col2") + 2 elsepreviousValue = 0end ifrs.closers.open "SELECT * FROM <tablename>",con,2,3rs.addnewrs("col1") = 123rs("col2") = previousValuers.updaters.close |
 |
|
|
|
|
|