I want to modify the Stored Procedure below.
@UserID INT
@Unlock VARCHAR(4)
AS
SET NOCOUNT ON
IF NOT EXISTS (SELECT * FROM dbo.tblUnlockCode WHERE iUserID = @UserID)
BEGIN
IF ISNUMERIC(@Unlock) = 1
BEGIN
INSERT dbo.tblUnlockCode (iUserID, sUnlockCode) VALUES (@UserID, @Unlock)
END
I would actually like to add to it, to where if the iUserID exists Update the @Unlock to the new Pin, and if the iUserID exists on the table but the @Unlock gets erased on the textfield(in access) it gets removed from the Table. I only want to store the iUserIDs that 4 digit pins. How could I do that?
P.S. on access I am checking if the pin is 4 digits.