3 Replies - 979 Views - Last Post: 03 August 2012 - 10:47 AM

#1 austincr48  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 14
  • Joined: 31-July 12

Perform simple formula recursively?

Posted 02 August 2012 - 10:32 PM

Okay, I have driven myself crazy looking for this guys and I was hoping one of you could help me with it.
I've been trying to update a table in a database by adding +1 to every entry in a specific column. I am having trouble doing this and I was wondering if there was an efficient way of doing so. Thanks!
Austin
Is This A Good Question/Topic? 0
  • +

Replies To: Perform simple formula recursively?

#2 austincr48  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 14
  • Joined: 31-July 12

Re: Perform simple formula recursively?

Posted 02 August 2012 - 10:49 PM

Just noting that I am using MS SQL if it makes a difference
Was This Post Helpful? 0
  • +
  • -

#3 Atli  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 3730
  • View blog
  • Posts: 6,017
  • Joined: 08-June 10

Re: Perform simple formula recursively?

Posted 02 August 2012 - 10:51 PM

Have you tried just doing:
UPDATE the_table
SET the_column = the_column + 1



This works the same in pretty much all SQL databases.


P.S.
Moved to the MSSQL forum.

This post has been edited by Atli: 02 August 2012 - 10:53 PM

Was This Post Helpful? 1
  • +
  • -

#4 austincr48  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 14
  • Joined: 31-July 12

Re: Perform simple formula recursively?

Posted 03 August 2012 - 10:47 AM

Thanks that's great. Didn't know it could be done like that ^-^
-Austin
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1