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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Is there an easy way to Increment a value?

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-03-13 : 21:27:23
Fuzion writes "Hi,
I have a table named users, and it has two columns, username (varchar), and logins (int). Is there an efficient way to tell sql to increment the logins, by writing a store procedure or something? Right now, I'm querying the table through an asp page with "SELECT LogIns FROM Users WHERE UserName='someuser'" then I read this value, convert into an integer, add 1 to it, then i use "UPDATE Users SET Logins=@NewLogIns WHERE UserName='SomeUser'". Please let me know if there's a better way to do this. Thanks

- Fuzion"
   

- Advertisement -