x
login about faq Site discussion (meta-askssc)

SQL Exam Updates?????

Hello!

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 '12 at 02:43 AM in Default

Amber-Rose gravatar image

Amber-Rose
58 4 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:

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

answered Jan 17 '12 at 03:07 AM

ThomasRushton gravatar image

ThomasRushton ♦
29.2k 6 9 36

This works perfectly, Thanks for the help! :)

Jan 17 '12 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 '12 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 '12 at 04:35 AM

Grant Fritchey gravatar image

Grant Fritchey ♦♦
62.1k 12 19 66

Thank you too! :)

Jan 17 '12 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.

Follow this question

By Email:

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

By RSS:

Answers

Answers and Comments



Facebook logo Follow Ask SSC on Facebook
Find Ask SSC on Google+
linkedin logo Find us on LinkedIn

Topics:

x1834
x113
x18
x7

asked: Jan 17 '12 at 02:43 AM

Seen: 565 times

Last Updated: Jan 17 '12 at 04:04 AM

Copyright © 2002-2012 Simple Talk Publishing. All Rights Reserved. If you have any queries, please contact the site administrators.
Ask SQL Server Central is a community service provided by Red Gate.