February 15, 2016 at 1:37 pm
How can I create a trigger to update rating to rating+1 if audio='choose one format' ?
The database model is located below .
February 15, 2016 at 3:27 pm
Please post:
- The relevant table(s) - in the form of a CREATE TABLE statement that I can copy/paste, not as an image; and do include all constraints and indexes, please
- A few rows of carefully selected sample data to show the starting point - in the form if INSERT statements that we can copy/paste
- A few data modification statements that should fire the trigger, and the desired end result in the table(s) after the statements and trigger have executed.
February 15, 2016 at 4:16 pm
e.hoxholli (2/15/2016)
How can I create a trigger to update rating to rating+1 if audio='choose one format' ?The database model is located below .
Have you ever created a trigger before?
--Jeff Moden
Change is inevitable... Change for the better is not.
February 15, 2016 at 4:32 pm
Try Books Online (https://msdn.microsoft.com/en-us/library/ms189799.aspx) - it is a great resource. Also, I recommend a beginners book on TSQL (Wrox has a good one IIRC).
Best,
Kevin G. Boles
SQL Server Consultant
SQL MVP 2007-2012
TheSQLGuru on googles mail service
February 15, 2016 at 4:47 pm
e.hoxholli (2/15/2016)
How can I create a trigger to update rating to rating+1 if audio='choose one format' ?The database model is located below .
Looking at the ERD you provided, you need to do a join from the Audio table through the DVD table using the AudioID and then join to the Movie table using the MovieID and then finally to the Rating Table using the RatingID. If you can provide that as an UPDATE statement, one of us can show you how to correctly fold it into a trigger (you have to have some of the fun ;-))
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 5 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply