EnVisageOnline/Main/Database/Scripts/20160127/2_UpdateDeleteUserSproc.sql

26 lines
1.4 KiB
Transact-SQL
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

USE [EnVisage]
GO
/****** Object: StoredProcedure [dbo].[sp_DeleteUser] Script Date: 01/27/2016 4:33:22 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[sp_DeleteUser] (@Id uniqueidentifier) AS
BEGIN
BEGIN TRANSACTION
delete from PasswordResetRequest where UserId=@Id
delete from User2Team where UserId = @Id
delete from User2View where UserId = @Id
delete from UserPreferences where UserId = @Id
delete from AspNetUserClaims where [User_Id] = @Id
delete from AspNetUserLogins where [UserId] = @Id
delete from AspNetUserRoles where [UserId] = @Id
delete from AspNetUsers where id = @Id
COMMIT TRANSACTION
END