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
562 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 ==> | Transactions (6 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.
If you don't have a copy of the Music_01 database, follow the instructions at the following link to create it: www.wiseowl.co.uk/sql/exercises/standard/using-sql-server/5257/
Open the Soundtrack Transactions.sql file in the folder shown above. You'll find a script to create a new table, insert some rows into it and then select the results.
If you execute the script you'll encounter an error.
One of the INSERT statements isn't working.
The problem is that our Volume column only allows values up to 10 but one of the soundtracks exceeds that limit.
"These go to eleven."
This means that we're left with an incomplete set of records in the table.
A Spinal Gap?
Add a TRY block around the group of INSERT statements in the script.
Add a CATCH block below this which shows the result of the ERROR_MESSAGE() and ERROR_NUMBER() functions.
The results you should see after executing the script.
If any of the INSERT statements fail, we'd like to reset the data in the table to the state it was in before we attempted to modify it.
Above the TRY block, begin a new transaction.
Inside the TRY block, choose to COMMIT the transaction when all the INSERT statements have succeeded.
Inside the CATCH block, choose to ROLLBACK the transaction.
When you execute the script you should be left with an empty table.
Modify the constraint in the table to allow the Volume column to accept values up to 11.
"It's one louder."
Execute the script again to see the final results.
Finally, a full set of soundtracks.
Save and close the script.
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.