Hello!
I have an assignment to do, so for any possibly help I'll be grateful.
I've created a database in SQL Server, with 3 tables (auctions, users and products).
Now I need to create a STORED PROCEDURE with 2 parameters: id of user and id of auctions. Procedure must check if user has possibility to do a bid (does he has enough bids). If he has enough bids, transaction will be run where first will be set a bid for a auction (the value of a bid field will raise for one) and then user bid will be decreased by one.
[From comment]
Table Auctions:
id productid lastbider bidvalue lastbid
1 1 2 3.00 70
2 2 1 3.00 23
Table Users:
id name password bids
1 Peter 123 9
2 Sally 456 19
Table Product:
id name
1 Plasma TV
2 LapTop
Procedure name is usp_makebid
Here is what I've started doing:
CREATE PROCEDURE usp_makebid
( @userID varchar
@auctionID varchar)
AS
BEGIN
SELECT auctions.id, users.id AS Expr1
FROM auctions INNER JOIN
users ON auctions.id = users.id
And I really don't know what to do next. :(
Can you just help me with what should I use ...