?
Solved

Addition functionality in SQL Statement?

Posted on 2008-06-12
3
Medium Priority
?
1,148 Views
Last Modified: 2010-04-21
I have the following SQL Statement:

SELECT TOP 1 MORTGEE_NUMBER FROM MORTGEE ORDER BY MORTGEE_NUMBER DESC

This returns the highest "AutoNumber" in my table - MORTGEE.

I would like to add one to this number, via sql if possible, or any other suggestion.  This is an integer.

THanks,

JD
0
Comment
Question by:jamesdean666
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 48

Accepted Solution

by:
hernst42 earned 1000 total points
ID: 21769645
You can try:

SELECT TOP 1 MORTGEE_NUMBER+1 FROM MORTGEE ORDER BY MORTGEE_NUMBER DESC
0
 
LVL 43

Assisted Solution

by:TimCottee
TimCottee earned 1000 total points
ID: 21769648
Hello jamesdean666,

SELECT TOP 1 MORTGEE_NUMBER + 1 FROM MORTGEE ORDER BY MORTGEE_NUMBER DESC

Or

Select Max(Mortgee_Number)+1 From Mortgee


Regards,

TimCottee
0
 

Author Closing Comment

by:jamesdean666
ID: 31466557
Perfect, thanks.
0

Featured Post

Tech or Treat!

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
It is possible to export the data of a SQL Table in SSMS and generate INSERT statements. It's neatly tucked away in the generate scripts option of a database.
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question