1 Replies - 569 Views - Last Post: 30 July 2016 - 04:24 PM

#1 fearfulsc2   User is offline

  • D.I.C Head

Reputation: 9
  • View blog
  • Posts: 179
  • Joined: 25-May 16

Capacity Limiter?

Posted 30 July 2016 - 03:49 PM

Hey everyone, I am trying to figure out a way to have a certain limit to the amount of time something is used in a table.

So let's say there is an item and there are only 10 of that one item. Once the 10th one has been taken or filled up, it is no longer available. How would I be able to do that in SQL? I have always set up those kinds of things when using a combination of html, php, javascript/jquery, and sql together. Is it possible to do it only on SQL using a CONSTRAINT or something like that? Maybe a trigger?

I have something like this so far, but I have no idea how to decrement or make the capacity be full
CREATE TABLE Course.Course
	CourseID INT NOT NULL Identity(1,1),
	CourseName NVARCHAR(50) NOT NULL,
	CourseCapacity INT NOT NULL

Is This A Good Question/Topic? 0
  • +

Replies To: Capacity Limiter?

#2 astonecipher   User is offline

  • Senior Systems Engineer
  • member icon

Reputation: 2539
  • View blog
  • Posts: 10,171
  • Joined: 03-December 12

Re: Capacity Limiter?

Posted 30 July 2016 - 04:24 PM

What you are wanting to do, is solved in this same manner, http://www.dreaminco...egistration-db/
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1