In this SQL Stored Procedure, where do I enter my Variable
I manage a SQL site but know next to nothing about SQL. In the backend, I found this Stored Procedure to Unlock a User, but don't know how to execute it. There is an "Apply Code" button. I just need to know where do I put the Username I need to unlock? Say the Username is SUZY ... exactly what do I replace with SUZY before I hit APPLY? Thank you so much!! ==CODE========= USE [TestSite] GO /****** Object: StoredProcedure [dbo].[aspnet_Membership_UnlockUser] Script Date: 07/10/2017 07:55:21 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER OFF GO ALTER PROCEDURE dbo.aspnet_Membership_UnlockUser @ApplicationName nvarchar(256), @UserName nvarchar(256) AS BEGIN DECLARE @UserId uniqueidentifier SELECT @UserId = NULL SELECT @UserId = u.UserId FROM dbo.aspnet_Users u, dbo.aspnet_Applications a, dbo.aspnet_Membership m WHERE LoweredUserName = LOWER(@UserName) AND u.ApplicationId = a.ApplicationId AND LOWER(@ApplicationName) = a.LoweredApplicationName AND u.UserId = m.UserId IF ( @UserId IS NULL ) RETURN 1 UPDATE dbo.aspnet_Membership SET IsLockedOut = 0, FailedPasswordAttemptCount = 0, FailedPasswordAttemptWindowStart = CONVERT( datetime, '17540101', 112 ), FailedPasswordAnswerAttemptCount = 0, FailedPasswordAnswerAttemptWindowStart = CONVERT( datetime, '17540101', 112 ), LastLockoutDate = CONVERT( datetime, '17540101', 112 ) WHERE @UserId = UserId RETURN 0 END GO
Open New Query Window in SQL Server Management Studio and connect to the instance that you would like to run the stored procedure against. Change "master" database from the drop-down list to the database (TestSite) where the stored procedure had been deployed. Then run this: EXEC dbo.aspnet_Membership_UnlockUser @ApplicationName = N'YOUR APP NAME', @UserName = N'SUZY'; Replace N'YOUR APP NAME' with the appropriate application name.
Thank you so much for helping. I am not clear on how to do this. Here is a screenshot of where I was trying to enter it. Can I enter that code somewhere in this window then click APPLY or do I have to go to SS Management Studio? ![alt text] : /storage/temp/4183-storedprocedure.jpg