Home All Groups Group Topic Archive Search About

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



Author
15 Mar 2006 12:07 AM
vampyreapocalypse@gmail.com
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

Author
15 Mar 2006 4:36 AM
Adrienne Boswell
Gazing into my crystal ball I observed "vampyreapocaly***@gmail.com"
<vampyreapocaly***@gmail.com> writing in news:1142376391.654465.138280
@j33g2000cwa.googlegroups.com:

Show quote
> 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

--
Adrienne Boswell
http://www.cavalcade-of-coding.info
Please respond to the group so others can share

AddThis Social Bookmark Button