-- *****************************************************************************************************************************************
--- SAMPLE INSERT UPDATE
-- *****************************************************************************************************************************************
USE [VO]
GO
SET ANSI_NULLS OFF
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[STEVE_UPDATE_INSERT_SAMPLE] (
@Name_Last varchar(50),
@Name_First varchar(50),
@UserID varchar(50),
@Password varchar(50),
@ID_Users_Level int,
@Email_Address varchar(50)
)
AS
BEGIN
set nocount on;
--- Try to update first...
UPDATE Users SET Name_Last = @Name_Last
WHERE UserId = @UserID
-- If not there, then insert...
IF @@ROWCOUNT=0
BEGIN
INSERT INTO Users (name_last,name_first,userid,password,id_users_level,email_address)
VALUES (@Name_Last,@Name_First,@UserID,@Password,@ID_Users_Level,@Email_Address)
END
END -- StoredProcedure
-- exec STEVE_UPDATE_INSERT_SAMPLE 'Barragan','Nelson','NelsonBarragan','1234',1,'Nelson@Barragan.com'
-- select name_last,name_first,userid,password,id_users_level,email_address from users where userid = 'NelsonBarragan'
-- *****************************************************************************************************************************************
-- *****************************************************************************************************************************************