Setting a variable equal to the "size" of my database

V

vampyreapocalypse

HI everyone,

I have an SQL database that tracks workorders for my company. Each
workorder is ID'ed by a number, i.e.: 1234. The next would be 1235,
1236, etc. I need a loop to go through EVERY workorder in the database.
How do I set a variable = to the largest WorkorderID in the database?
i.e.: That would be 1500 if there were 1500 workorders in the database.
Don't worry, there are other checks in place so that it won't always
loop through every single workorder (I thought about that already).

Thanks in advance,
Andrew
 
A

Adrienne Boswell

HI everyone,

I have an SQL database that tracks workorders for my company. Each
workorder is ID'ed by a number, i.e.: 1234. The next would be 1235,
1236, etc. I need a loop to go through EVERY workorder in the database.
How do I set a variable = to the largest WorkorderID in the database?
i.e.: That would be 1500 if there were 1500 workorders in the database.
Don't worry, there are other checks in place so that it won't always
loop through every single workorder (I thought about that already).

Thanks in advance,
Andrew

SELECT MAX(WordorderID) FROM tablename
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,756
Messages
2,569,540
Members
45,025
Latest member
KetoRushACVFitness

Latest Threads

Top