Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting a number from a select max statement?

Status
Not open for further replies.

Stegmite

Programmer
Aug 18, 2004
36
US
I'm trying to get the highest number in a column, then add 1 to it (for unique contraints).
Code:
SELECT MAX(USER_ID) FROM CLIPR.USERS;

How can I get the number that this comes up with?
 
Ummm, is this a VB.Net question? The simplest way would be to create a Command Object (either SqlCommand, OleDBCommand, OracleCommand; whichever applies) and assign the .ExecuteScalar() function of it to a variable.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top