Solved

Addition functionality in SQL Statement?

Posted on 2008-06-12
3
1,143 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
3 Comments
 
LVL 48

Accepted Solution

by:
hernst42 earned 250 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 250 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Count with a subquery showing details 10 48
SYbase 4 36
Downgrading MS SQL 2008 R2 Enterprise to MS SQL 2005 Standard? 12 65
Need help with a Stored Proc on Sql Server 2012 4 28
PL/SQL can be a very powerful tool for working directly with database tables. Being able to loop will allow you to perform more complex operations, but can be a little tricky to write correctly. This article will provide examples of basic loops alon…
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

856 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