SQL Exam Updates?????


My company have created a website where employees will be able to take a test to earn points (CPD hours) which will be updated every time an employee takes the test.

I am trying to find a way to update the number of CPD hours each employee has earned by using SQL, and displaying this on their profile page.

The number of CPD hours awarded will need to be updated every time they earn more points. Every time they take the test, 2 CPD hours will be added.

Any help on this would be much appreciated! :) Thanks!
more ▼

asked Jan 17, 2012 at 02:43 AM in Default

Amber-Rose gravatar image

58 5 6 8

(comments are locked)
10|1200 characters needed characters left

3 answers: sort voted first

If it's as simple as updating the hours each time they take the test, then you could update their hours in the data table by using something like:

SET SQLHours = SQLHours + 2
WHERE UserName = 'Fred'
more ▼

answered Jan 17, 2012 at 03:07 AM

ThomasRushton gravatar image

ThomasRushton ♦
34.1k 18 20 44

This works perfectly, Thanks for the help! :)
Jan 17, 2012 at 05:43 AM Amber-Rose
If the CPD hours are actually significant in some way, it may be worth also having an audit/log table tos how when and why the hours got changed.
Jan 17, 2012 at 10:38 AM TimothyAWiseman
(comments are locked)
10|1200 characters needed characters left
And in addition to what @ThomasRushton says, you need to have the web page run a query to retrieve the data from the database. Then, as the data gets updated, the web site will as the pages load.
more ▼

answered Jan 17, 2012 at 04:35 AM

Grant Fritchey gravatar image

Grant Fritchey ♦♦
103k 19 21 74

Thank you too! :)
Jan 17, 2012 at 05:53 AM Amber-Rose
(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

New code box

There's a new way to format code on the site - the red speech bubble logo will automatically format T-SQL for you. The original code box is still there for XML, etc. More details here.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.



asked: Jan 17, 2012 at 02:43 AM

Seen: 918 times

Last Updated: Jan 17, 2012 at 04:04 AM