Posts Tagged ‘while’
SQL CURSOR – SQL For Programmers
One of the things it took me a while to figure out was how to get a stored procedure to loop through data in a table and pull out specific data I needed.
There are actually two parts to this question. First, you should always try to find some other way of doing whatever it is you think you need to do by processing one row at a time. SQL is a “Set-Based” language and as such it expects you to work with the whole set. That’s what it was designed to do best and that’s why it has functions such as MAX, MIN, SUM, AVG, etc. Many of these functions in combination with a good WHERE clause will get you the information you need.
However, there are times when you’ll need to process the information one record at a time, and this is what the CURSOR was created for.
Other Related Items:
West Paw Bumi Dog Toy - Large (Colors Vary)Introducing Bmi - the interactive toy that your dog wont want to put down! BmiTM is the active dogs dream come true, charged with energetic fun! Bmi i... Read More >
Indigo Teen Dreams: Guided Relaxation Techniques Designed to Decrease Stress, Anger and Anxiety while Increasing Self-esteem and Self-awareness (Indigo Dreams)Indigo Teen Dreams allows teens to manage stress, anger, and anxiety while increasing self-esteem and self-awareness. Teens explore the research-based... Read More >
Norpro Stainless Steel Vertical Poultry RoasterNorpro's vertical poultry roaster is designed to allow fats to drip off your chicken or other poultry as it cooks, leaving only juicy, flavorful, low... Read More >
SQL WHILE – SQL For Programmers
The IF statement we looked at on Tuesday was pretty tame compared to the WHILE construct.
Actually, the main thing you need to keep in mind is that WHILE is all you have. There is no such thing as a FOR loop or a DO WHILE loop. So, you have to force WHILE to do those for you.
The basic syntax of WHILE looks like this:
Other Related Items:
Sony VGP-BPL15/B VAIO Extended Batteries for P Series Lifestyle PC (Black)Stay productive longer while you're away from a power source with your VAIO P Series Lifestyle PC and this extended battery.Ideal for extended compute... Read More >
NETGEAR WN511T RangeMax Next Wireless-N Notebook AdapterRangeMax NEXT EXTends the possibilities of your wireless home network by providing a Steady-Stream of up to 300Mbps, and is compliant with draft 802.1... Read More >
CAUTION DO NOT ENTER WHILE EQUIPMENT IS OPERATING 12" x 18" Plastic SignEquipment Machinery & Operations Safety Signs. CAUTION DO NOT ENTER WHILE EQUIPMENT IS OPERATING. 12" x 18" Plastic Sign

