troubleshooting Question

An INSERT statement with SELECT in DB2 and SQL Server

Avatar of diteps06
diteps06Flag for United States of America asked on
Microsoft SQL ServerDB2SQL
7 Comments4 Solutions88 ViewsLast Modified:
I have a table ITEMS with the following columns:
23      ABC
24      DEF

I will like to insert a new record in the table and the next value of ID should be the max +1 (25).
The script will be run in different environments so the last value maybe different.
I will like to create an INSERT statement to be something like this:

The same statement will be executed for a DB2 and SQL Server db.
Is the above statement valid in both db?
Kent Olsen
Data Warehouse / Database Architect

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 4 Answers and 7 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 4 Answers and 7 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros