Read our blogs, tips and tutorials
Try our exercises or test your skills
Watch our tutorial videos or shorts
Take a self-paced course
Read our recent newsletters
License our courseware
Book expert consultancy
Buy our publications
Get help in using our site
546 attributed reviews in the last 3 years
Refreshingly small course sizes
Outstandingly good courseware
Whizzy online classrooms
Wise Owl trainers only (no freelancers)
Almost no cancellations
We have genuine integrity
We invoice after training
Review 30+ years of Wise Owl
View our top 100 clients
Search our website
We also send out useful tips in a monthly email newsletter ...
Software ==> | SQL (203 exercises) |
Topic ==> | Looping (5 exercises) |
Level ==> | Relatively easy |
Subject ==> | SQL training |
This exercise is provided to allow potential course delegates to choose the correct Wise Owl Microsoft training course, and may not be reproduced in whole or in part in any format without the prior written consent of Wise Owl.
Open the Times Tables.sql file in the folder shown above. You'll find the outline of a script to create a stored procedure which will print out multiplication tables.
Declare a TINYINT variable in the procedure which you can use to count through iterations of a loop. Set the variable's initial value to 1.
Create a WHILE statement which continues looping while the variable's value is no greater than 10.
Inside the loop, multiply the value of the variable by the value of the @Multiplier parameter and use a PRINT statement to display the result.
Add another statement inside the loop to increase the value of the variable by 1.
Don't forget to wrap the loop statements in a BEGIN END block.
Execute the script to create the procedure then create another script which you can use to test it.
An example of the results you might see.
Save and close the scripts.
You can find other training resources for the subject of this exercise here:
Kingsmoor House
Railway Street
GLOSSOP
SK13 2AA
Landmark Offices
99 Bishopsgate
LONDON
EC2M 3XD
Holiday Inn
25 Aytoun Street
MANCHESTER
M1 3AE
© Wise Owl Business Solutions Ltd 2024. All Rights Reserved.