如何增加sql server中的单元格值? [英] How to increment the value of cells in sql server?

查看:140
本文介绍了如何增加sql server中的单元格值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何增加SQL Server 2008中单元格的值

ex。

How to increment the value of cells in SQL Server 2008
ex.

date | name | money | address
4  | men  |  10   | new york
1  | fmale|  50   | USA
3  | jef  |  60   | JAPAN
3  | jef  |  60   | JAPAN
3  | jef  |  60   | JAPAN





我希望看起来像这样



I want the out looks like this

date | name | money | address
4  | men  |  10   | new york
1  | fmale|  50   | USA
3  | jef  |  60   | JAPAN
3  | jef  |  70   | JAPAN
3  | jef  |  80   | JAPAN





我想要的是那个。该表将查找货币中的最后一个数字(例如fmale money 50),因此所有jef货币将增加10.这将看起来像第二个插图?如何在sql server中编写代码?



what i want is that. the table will look for the last number found in money (e.g. fmale money 50) so all jef money will increment by 10.it will looks like the second illustration? how to code that in sql server?

推荐答案

使用Money上的Identity Specification列;种子为10,增量为10 ...

然后你可以开始插入行(省略金钱),金钱会自动增加。



http://msdn.microsoft.com/en-us/ library / ms186775(v = sql.100).aspx [ ^ ]
Use Identity Specification on Money column; with the seed as 10 and increment as 10...
Then you may start inserting rows(omit Money) and Money will get incremented automatically.

http://msdn.microsoft.com/en-us/library/ms186775(v=sql.100).aspx[^]


这篇关于如何增加sql server中的单元格值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆