SQL Server Programming Part 5 – IF Statements

Video is ready, Click Here to View ×

If you’d like to help fund Wise Owl’s conversion of tea and biscuits into quality training videos you can click this link http://www.wiseowl.co.uk/donate?t=1 to make a donation. Thanks for watching!

By Andrew Gould

http://www.wiseowl.co.uk – IF statements in SQL allow you to check if a condition has been met and, if so, to perform a sequence of actions. This video teaches you everything from the basic syntax of IF statements, including how to use the ELSE clause and perform multiple actions using a BEGIN and END block. We’ll also teach you how to nest your IF statements, including a few useful tips on how to make your nested IFs readable!

You can see more examples of IF in written form here:

You can download the script to create the Movies database used in this video at the following link:

You can see the range of resources and courses we offer in SQL Server…

sql tutorial for beginners with examples


19 thoughts on “SQL Server Programming Part 5 – IF Statements”

  1. As written, wouldn't it still return "You must choose ALL, AWARD, or FINANCIAL" even if you DID provide one of those three when executing the procedure? Wouldn't you have to nest those IF statements and then have the last SELECT statement after an ELSE statement?

  2. I tried doing this tutorial and used the database creation file you provided here, but the database does not have the FilmGenreID column in the tblFilm table …. did you make this column in another tutorial that I missed …. or am I missing something altogether? …. Thank you, your tuts are excellent. 🙂

  3. Awesome! I appreciate it, that would really help with something I'm working on at work where I have to use a matrix and let the user select the row, column or data fields. The error I was getting referred to a data type issue and I'm not sure what I'm doing wrong in the example – again thank you for your help – your videos are outstanding.

  4. great video. I have a question. Would you be able to do a video on Dynamic Matrices in SSRS? you have a tutorial on your website and I followed it, but i'm getting errors when running the report. i have a requirement to create a report like this, but cant seem to find any documentation online and your link below is the only one that has anything on the subject.

Leave a Reply

Your email address will not be published. Required fields are marked *