This stored procedure provides the engine for the authentication step in the IBuySpy application. It accepts Email and Password and returns the CustomerID if successful. If unsuccessful, it returns 0.
Definition:CREATE Procedure CustomerLogin ( @Email nvarchar(50), @Password nvarchar(50), @CustomerID int OUTPUT ) AS SELECT @CustomerID = CustomerID FROM Customers WHERE EmailAddress = @Email AND Password = @Password IF @@Rowcount < 1 SELECT @CustomerID = 0Database Tables Used:
Customers: The Customers table keeps track of all customer information in the system. The primary key is CustomerID and we store the users' full name, email address and password. It has a one to many relationship with the Orders table.