SQLize Online / PHPize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
USE [BNBAstraVisa] GO /****** Object: StoredProcedure [dbo].[AddUsers] Script Date: 26-05-2023 07:59:36 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER PROCEDURE [dbo].[AddUsers] ( @Id int, @INTUSERID int=null, @UserName nvarchar(max)=null, @Password nvarchar(max)=null, @BLNActive int=null, @3DESSwitch int=null, @salt nvarchar(20)=null ) AS BEGIN ----****************** Fill Grid View of Roles ****************** --if @Id='0' -- Begin -- select RoleId,RoleName,Description from Roles -- end ----****************** Add New Users for switch and 3DES ****************** if @id = '1' begin insert into TBLUSER values(@UserName,@Password,@BLNActive,0,@3DESSwitch) insert into tbluser_account(USERID,SALT,BITISREMOVED) values(@UserName,@salt,0) end --****************** Show / Display Users for 3DES****************** if @id = '2' begin select INTUSERID,STRUSERNAME,STRPASSWORD,BLNACTIVE,BLNISSUPERUSER from TBLUSER where BITISREMOVED=0 and BLNISSUPERUSER=2 end -- --****************** Show / Display Users for switch****************** if @id = '3' begin select INTUSERID,STRUSERNAME,STRPASSWORD, BLNACTIVE,BLNISSUPERUSER from TBLUSER where BITISREMOVED=0 and BLNISSUPERUSER=1 end ----****************** Delete Users ****************** --if @id = '4' -- begin -- UPDATE Users SET -- IsRemoved=1 -- WHERE UserId=@UserId; -- end --****************** Check Distinct user name(Dont allow to enter dublicate role.) for 3DES ****************** IF @id = '4' BEGIN SELECT 1 AS varUserName FROM TBLUSER WHERE STRUSERNAME=@UserName and BLNISSUPERUSER=2 END --****************** Check Distinct user name(Dont allow to enter dublicate role.) for switch ****************** IF @id = '5' BEGIN SELECT 1 AS varUserName FROM TBLUSER WHERE STRUSERNAME=@UserName and BLNISSUPERUSER=1 END END ----****************** Edit Users ****************** if @id = '6' begin UPDATE TBLUSER SET STRUSERNAME=@UserName, STRPASSWORD=@Password, BLNACTIVE=@BLNActive, BITISREMOVED=0, BLNISSUPERUSER=@3DESSwitch WHERE INTUSERID=@INTUSERID update tbluser_account set SALT=@salt where USERID=@UserName end
Stuck with a problem? Got Error? Ask ChatGPT!
Copy Clear