Want to become a Vibe Coder? Join Vibe Coding Training here
x
C# Corner
Tech
News
Videos
Forums
Jobs
Books
Events
More
Interviews
Live
Learn
Training
Career
Members
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Refer
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
SQL Server Query to Get the Max +1 ID from a Table
WhatsApp
Bineesh Viswanath
May 24
2016
1.1
k
0
0
SELECT
max
(
cast
(column_name
as
int
)) + 1
FROM
table_name
Lets look at the real time example:
I have a table named PRODUCTS. If want to get the Max +1 ProductID(PK) from this table, can use the following code:
SELECT
max
(
cast
(ProductID
as
int
)) + 1
FROM
PRODUCTS
SQL Server
SQL Query
Max +1 ID
Up Next
SQL Server Query to Get the Max +1 ID from a Table